hi I need to select the ten latest entries from a diary-database, but i don't want to get any duplicate users, so if i want to select the ten latest entries and someone has written five entries of these latest ones, i only want to get the latest entries from each user. So far no problem, my query below fixes that. But the problem is that i also want to get the correct headline from the latset entries from each person.
Since mysql dosen't support subselects i have tried to use userdefined variables and the max()-function in a where-clause, but i found that it's not possible to use these methods. If anyone got a solution i would be really happy. The fields in the database looks like this: referer - int time - datetime headline - varchar My current nonworking query looks like this: select referer,max(time) as maxtime,headline from diary group by referer order by maxtime desc limit 10; /tobias --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php