0

I have MySql Workbench 6.2CE (hope this helps..) And I'm trying to an offset query like this :

SELECT id FROM nameTable OFFSET 10 ROWS; 

But it give me a syntax error on the 10 : is not a valid input in this position. Anyone knows the problem ?Thank you!

1 Answer 1

3

The syntax is wrong and its

select * from table order by someid
[LIMIT {[offset,] row_count | row_count OFFSET offset}]

https://dev.mysql.com/doc/refman/5.0/en/select.html

Note that limit without order by is having no meaning.

SELECT id FROM nameTable order by id limit 10 OFFSET 10
Sign up to request clarification or add additional context in comments.

2 Comments

ow i see, then if i want to use OFFSET, i should use ORDER BY and LIMIT too, right ?
Well mysql does not preserve ordered data while returning data , so its better to use order by clause for a meaning full result. You may use different version of limit something as limit 0,10 or limit 10 offset 0 are same.

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.