scooby
scooby

Reputation: 603

Selecting the newest row in T-SQL

I have a database table 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?

Upvotes: 1

Views: 350

Answers (1)

FreeAsInBeer
FreeAsInBeer

Reputation: 12979

SELECT TOP 1 * FROM [tableName] ORDER BY timestamp DESC

Upvotes: 6

Related Questions