tags:

views:

28

answers:

1

I was trying to achieve this in SQL, lets say i have a table like below

ID       DATE
7   2009-12-06 
7   2009-01-06 
7   2009-12-19 
7   2009-12-09 
7   2009-20-06 
9   2009-07-06 
9   2009-11-06 
10  2009-01-06 
10  2010-12-06 
10  2009-04-06 
11  2009-08-06 
11  2009-10-16
11  2009-11-19
12  2009-12-26
13  2009-04-16 
13  2009-09-06 
14  2009-12-06 

I want to get the latest date for each ID, for example, i was trying to do a query which will give me something like this

ID    DATE

7     2009-12-19 
9     2009-11-06 
10    2010-12-06 
11    2009-11-19
13    2009-09-06
14    2009-12-06

Thanks

+4  A: 
select ID, MAX(DATE) as DATE
from MyTable
group by ID
order by ID
RedFilter
duh! thanks for ur help
Joe
To quote Jimi Hendrix: Hey Joe, where you goin' without accepting RedFilter's answer? :)
djacobson
@ djaccobson --site doesn't allow to accept answers till after 15 mins :)
Joe