0

Is it possible for me with MySQL to select the from a specific row to the end of the table, without knowing how many rows there are left?

My query at the moment is:

SELECT * FROM updates WHERE userid='$fid' ORDER BY up_id DESC

But I want to be able to something like:

SELECT * FROM updates WHERE userid='$fid' ORDER BY up_id DESC LIMIT '$myRow' to EndOfTable

Can this be done?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Colum
  • 996
  • 2
  • 8
  • 23

1 Answers1

2

Just use a large value like 999999999 that is going to be bigger than the table. So:

limit $myRow, 999999999

Although less popular, I prefer the syntax:

limit 999999999 offset $myrow
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
  • @Colum . . . `limit` is applied after all the real work for the query has been done. It *will* slow down your code, but only because a larger volume of data needs to be processed (which is what you should be expecting). – Gordon Linoff May 20 '14 at 19:08
  • Its the best approach to my problem so it will have to do – Colum May 20 '14 at 19:09