I’m trying to GROUP BY a column and have the row with the latest timestamp to be returned. Example:
TABLE Test
id | text | timestamp
1 , ‘A’ , 2008-03-01
1 , ‘B’ , 2008-03-26
SELECT *
FROM Test
GROUP BY id
RESULTS:
1 , ‘A’ , 2008-03-01
I need the results to be the row with the latest timestamp:
1 , ‘B’ , 2008-03-26
I know i can nest queries to do this but this will result in temporary tables which will not be optimized. Is it possible to Order By before the Group or get this result using another method?