firstprayer
firstprayer

Reputation: 826

How to skip rows in MySQL

I know MySQL has LIMIT clause, which has the following two usages:

  1. LIMIT k: meaning result[: k]
  2. LIMIT m, n: meaning result[m: m + n]

However, what if I want result[k: ]? That is, I want to skip the first k rows, and get all the rests. Is it supported?

Upvotes: 2

Views: 8908

Answers (2)

A l w a y s S u n n y
A l w a y s S u n n y

Reputation: 38502

Check the keyword OFFSET :

 SELECT column FROM table LIMIT 10 OFFSET k

see here for more http://dev.mysql.com/doc/refman/5.0/en/select.html

Upvotes: 4

Gordon Linoff
Gordon Linoff

Reputation: 1269873

You can just put in a really big value for the limit. Something like this usually works:

limit k, 999999999

Upvotes: 4

Related Questions