Search code examples
mysqlsqlsql-limit

Select from row to last row


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?


Solution

  • 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