Distinct with Order By

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm looking for the last six different people to make entries to a table,
but this syntax:

SELECT DISTINCT Poster_ID FROM Posting ORDER BY Posting_Date DESC LIMIT 6;

Gives a result which is absolutely not ordered by date. Removing the
DISTINCT keyword results in a correct list of the last six people, but they
can all be the same person, which won't do.

I've found some reference on mysql.com to this being a tricky combination
(due to optimization), but there wasn't enough info there for me to go on.
It talked about using temporary tables, but that's out of my experience.

Can someone give me some advice on this?

-e

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux