MySQL LIMIT not working

I have a MySQL 5.0 server and I execute this query:

SELECT * FROM deals WHERE expires > "2012-05-25 19:37:58" AND city =2 ORDER BY UIN LIMIT 48 , 57 

And he returns:

Showing lines 0 - 29 (total 57 queries, total 0.0036 sec)

Am I doing something wrong? I expect 9 lines, 48-57 ..

+4
source share
3 answers

The second parameter LIMIT not an offset, it is the length relative to the offset. Therefore, if you want 9 lines, it will be LIMIT 48, 9 .

+14
source
 LIMIT 48 , 57 

will display 57 entries after the 48th entry.

Try

 LIMIT 48 , 9 

http://php.about.com/od/mysqlcommands/g/Limit_sql.htm

+4
source

LIMIT works as follows: LIMIT (page - 1) * post_per_page, post_per_page

+1
source

Source: https://habr.com/ru/post/1414483/


All Articles