0

I want get top 1st row from orders table. The following query works in sql server:

select top 1(OrderID)
from dbo.Orders
order by OrderID desc 

But it does not work in MySql - how should it be written for MySql?

2 Answers 2

1

For MySQL use LIMIT

MySQL

select OrderID
from dbo.Orders
order by OrderID desc 
LIMIT 1;

SQL Server

select top (1) OrderID
from dbo.Orders
order by OrderID desc 
Sign up to request clarification or add additional context in comments.

Comments

0
SELECT OrderID FROM dbo.Orders
ORDER BY OrderID desc 
LIMIT 1;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.