DISTINCT on one column, ORDERED by another question...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I have tried looking this up and couldn't find a straightforward

I just want to find DISTINCT records on one column, but pick the most
recent one (a date in another column).


id | price | date_entered
1, 5, 2005
1, 6, 2004
2, 3, 2004

I can get DISTINCT records on the product id (I use GROUP BY,
actually), but it displays the 2004 record. I want the most recent
record for any distinct product...

my query:
SELECT * FROM `products` GROUP BY `id`

How do I modify this to get GROUP BY to order by date_entered DESC?

I also had a SELECT DISTINCT (id) ... query but couldn't get all the
data to return...


Site Timeline