1

I'm currently trying to setup a query that only selects from a row number and upwards from it. I've tried to use the LIMIT method in this way:

SELECT name FROM names LIMIT 1500, *

Which I expected to select from row number 1500 till the table's rows ended, but got a MySQL error instead.

I then tried to use a conditional for the ID of the rows like so:

SELECT name FROM names WHERE id >= 1500

Which gave unpredictable behavior since there are rows that get deleted, so it's not taking the real row numbers.

Ivar
  • 6,138
  • 12
  • 49
  • 61
Jack Hales
  • 1,574
  • 23
  • 51

2 Answers2

2

I think offset will do what you want. Unfortunately, MySQL requires a LIMIT value, but you can just put in a ridiculous number:

SELECT name
FROM names 
OFFSET 1499
LIMIT 999999999;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
1

you could use a subquery

select name 
from names 
where id > (
    select max(id) 
    from names 
    order by names  
    limit 1500 
)
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107