Hi,
I have problems with a MySQL select query. I have a table with a MySQL timestamp field 'posttime', a field 'listname', a field 'postid' and and a field 'replyid'. rows can have the same listname value and the same postid value. They can never have the same listname and postid and replyid value.
What I need is a query that returns the 10 latest posts but it should never return rows with the the same postid. I tried this:
SELECT t1.*, MAX(t2.posttime) AS posttime FROM messages t1, messages t2 WHERE t1.listname=t2.listname AND t1.postid=t2.postid AND t1.replyid='0' GROUP BY t1.postid ORDER BY posttime DESC Limit 0, 10
This returns 10 rows but after checking, not the correct rows.
Anyone knows how to do this?
Thnx, Raoul