By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,612 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

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

P: n/a
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...


Aug 3 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.