This query will return the top for all rows in MS Access.
SELECT TOP 1 * FROM [table]
ORDER BY table.[Date] DESC;
I need to return the top date for each id that can have multiple dates.
ID DATE
1 01/01/2001
1 01/12/2011
3 01/01/2001
3 01/12/2011
Should return only the top dates like this.
1 01/12/2011
3 01/12/2011
You'll want to use the MAX function, along with a GROUP BY.
SELECT ID, MAX(DATE)
FROM [table]
GROUP BY ID
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With