Skip to content

Instantly share code, notes, and snippets.

@sergeykuzmich
Last active November 28, 2022 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergeykuzmich/7f075577b3bb06524f7bdcc5409771b0 to your computer and use it in GitHub Desktop.
Save sergeykuzmich/7f075577b3bb06524f7bdcc5409771b0 to your computer and use it in GitHub Desktop.
Cursored Query Previous Page
SELECT uid, title, content, datetime
FROM news
WHERE (datetime, uid) > ((SELECT datetime FROM news WHERE uid = :uid), :uid)
ORDER BY (datetime, uid) ASC
LIMIT :per_page;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment