Skip to content

Instantly share code, notes, and snippets.

View Segerberg's full-sized avatar

Andreas Segerberg Segerberg

View GitHub Profile
@Segerberg
Segerberg / pagination_example.sql
Created August 24, 2019 10:01 — forked from ssokolow/pagination_example.sql
Reasonably efficient pagination without OFFSET (SQLite version)
-- Reasonably efficient pagination without OFFSET
-- SQLite version (Adapted from MS SQL syntax)
-- Source: http://www.phpbuilder.com/board/showpost.php?p=10376515&postcount=6
SELECT foo, bar, baz, quux FROM table
WHERE oid NOT IN ( SELECT oid FROM table
ORDER BY title ASC LIMIT 50 )
ORDER BY title ASC LIMIT 10