webmasters
webmasters

Reputation: 5851

Query first 10 rows followed by the remaining rows

What I need is two queries similar to this one:

SELECT * FROM anchors WHERE site_url = '$site_current'

How can I do this?

Upvotes: 2

Views: 561

Answers (1)

Bohemian
Bohemian

Reputation: 425448

Query 1:

SELECT * FROM anchors WHERE site_url = '$site_current' LIMIT 10;


Query 2:

SELECT * FROM anchors WHERE site_url = '$site_current' LIMIT 10, 99999999999;

or (different syntax but with same effect):

SELECT * FROM anchors WHERE site_url = '$site_current' LIMIT 99999999999 OFFSET 10;

Unbelievably, with mysql you can't specify an offset without a limit, so you have to use this retarded syntax of having a massively large limit to get "all remaining rows", no matter which syntax version you use.

Upvotes: 6

Related Questions