Reputation: 59475
I have a table with 53 rows. My sql statement looks like this:
SELECT * FROM table LIMIT 1 , 100
It is showing me 52 rows instead of 53. What gives? Of course when I run:
SELECT * FROM table
It returns 53 rows as it should.
What is the best way to fix this, so that I can have a limit if I need it?
Upvotes: 0
Views: 665
Reputation: 240394
When you use LIMIT x, y
, the first value is an offset. So LIMIT 1, 100
means to skip the first 1 record, and show rows 2 through 101. To get the first 100 rows without skipping any, write LIMIT 0, 100
or simply LIMIT 100
.
Upvotes: 4