Selecting the newest row in T-SQL
I have a database ta开发者_运维技巧ble containing a column called timestamp
, which stores the system time for each of the rows inserted.
How do I select the row with the latest timestamp, i.e. the row that was inserted last?
SELECT TOP 1 * FROM [tableName] ORDER BY timestamp DESC
精彩评论