Admittedly I haven't been using much database code lately and something that I think I would have been able to handle on my own before, has me stumped today.
What I need are the 10 latest records, differentiated by a UNIX timestamp column (t1.posterTime).
This is the code as I thought it should be. I get correct results when I remove the GROUP BY but then get dupe rows. What I need are all distinct rows and then order them by the latest UNIX stamp. Easy I know, but I'm stuck. Should I be using a self join for this?
Quote:
SELECT t1.ID_TOPIC, t1.subject
FROM messages AS t1
GROUP BY t1.ID_TOPIC
ORDER BY
t1.posterTime DESC
LIMIT 10
|
Thanks for any help!
Frank