Sql – Select most recent record based on date

sqlsql server

I'm trying to create a select query that returns the most recent record from the table based on date. Basically whichever row's [Date] field is closest to the current date.

Sample Data:

    ID       Content         Date
--------------------------------------------
1   1050    Test Values    2013-11-27 10:46:24.900
2   1051    Test Test      2013-11-27 10:47:43.150
3   1057    Test Testx2    2013-11-27 10:48:22.820

I would like to only return these values

    ID       Content         Date
--------------------------------------------
1   1057    Test Testx2    2013-11-27 10:48:22.820

Thanks!

Best Answer

You could try the following query:

SELECT TOP 1 *
FROM Table
ORDER BY [Date] DESC