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
  • 5,377
  • 12
  • 50
  • 56
Jack Hales
  • 1,533
  • 24
  • 46

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,198,228
  • 53
  • 572
  • 709
1

you could use a subquery

select name 
from names 
where id > (
    select max(id) 
    from names 
    order by names  
    limit 1500 
)
ScaisEdge
  • 129,293
  • 10
  • 87
  • 97