I have the following data in Sybase ASE
id effectiveDate lastModificationDate rateValue
----- ---------------- -------------------- ------------
1 20130627 6/27/2013 3:27:09 AM 0
1 20130627 6/27/2013 4:39:10 AM 2.75
1 20130627 6/28/2013 3:48:15 AM 0
1 20130627 6/28/2013 4:36:43 AM 2.75
1 20130628 6/28/2013 3:48:14 AM 0
1 20130628 6/28/2013 4:36:42 AM 2.75
2 20130628 6/28/2013 4:36:42 AM .75
2 20130628 6/28/2013 3:48:14 AM 0
How do I group it, so that I get only the last row, ie I get the row which has the max lastModificationDate for the same id+effectiveDate.
So output would be :
id effectiveDate lastModificationDate value
----- ---------------- -------------------- ------------
1 20130627 6/28/2013 4:36:43 AM 2.75
1 20130628 6/28/2013 4:36:42 AM 2.75
2 20130628 6/28/2013 4:36:42 AM .75
Please note that this would be on TSQL (Sybase ASE 15). EDIT: Have changed the data to make it more realistic