For Example, I have table like this:
Date | Id | Total ----------------------- 2014-01-08 1 15 2014-01-09 3 24 2014-02-04 3 24 2014-03-15 1
Another way is by using INNER JOIN
INNER JOIN
Find the latest date per ID then join result back to the table to get the value
latest
ID
value
select A.ID,A.Date,A.value from yourtable A INNER JOIN ( select MAX(date) as Date,ID from yourtable group by ID ) B ON A.ID =B.ID and A.Date = B.Date