Do you have a question? Post it now! No Registration Necessary. Now with pictures!
August 3, 2005, 3:47 am
rate this thread
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...
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...
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum