<db list removed> On 16-Mar-2003 Daniel Harik wrote: > Hello, > > Guys i try to join to tables > > slides: > id > userid > file > moment > > users > id > username > > As there few slids per user and i want to get only last one, i use > following > sql query, but it fetches me first slide. How can i make it fetch last > one > please? > > SELECT slides.file, slides.moment, users.id, users.username FROM slides, > users where users.id=slides.userid GROUP BY users.id desc >
Which record is 'last' ? There is no order to the records without an 'ORDER BY' clause. If you figure that out, you can use a temporary table with all the desired fields and with the userid as primary key. Then do 'REPLACE INTO temptbl SELECT ... ORDER BY whatever'. And finally do a 'SELECT * FROM temptbl' Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php