V
V
Vanes Ri_Lax2015-11-20 08:57:18
SQL Server
Vanes Ri_Lax, 2015-11-20 08:57:18

MS SQL Server how to pull the last row correctly?

Hello,
I just started working with MSSQL Server, I need to pull out the last record in the query, I do it like this:

SELECT text FROM table WHERE user_id=5 ORDER BY id DESC LIMIT 1

Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2015-11-20
@streetflush

SELECT top 1 text FROM table WHERE user_id=5 ORDER BY id DESC
LIMIT not supported on older servers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question