Search code examples
mysqlsqloffset

MySql offset query not working


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!


Solution

  • 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