Hi All,
I have query that looks something like this :
select 1 as Id, '2014-05-25' as ToDate union select 1 as Id, '2014-05-26' as ToDate union select 2 as Id, '2014-05-25' as ToDate union select 2 as Id, '2014-05-27' as ToDate union select 3 as Id, '2014-05-20' as ToDate union select 3 as Id, '2014-05-19' as ToDate And i need result looks like this: (get only whose rows that contains max ToDate per Id)
Id |ToDate
------------ 1 2014-05-26 2 2014-05-27 3 2014-05-20
Is there a way to do this in the most efficient ?
Regards, Evgeniy.