In PostgreSQL there is the Limit
and Offset
keywords which will allow very easy pagination of result sets.
What is the equivalent syntax f
Since nobody provided this code yet:
SELECT TOP @limit f1, f2, f3...
FROM t1
WHERE c1 = v1, c2 > v2...
AND
t1.id NOT IN
(SELECT TOP @offset id
FROM t1
WHERE c1 = v1, c2 > v2...
ORDER BY o1, o2...)
ORDER BY o1, o2...
Important points:
@limit
can be replaced with number of results to retrieve,@offset
is number of results to skipwhere
and order by
clauses, and will provide incorrect results if they are out of syncorder by
is there explicitly if that's what's needed