Skip to content

Instantly share code, notes, and snippets.

@sygour
Last active August 29, 2015 14:10
Show Gist options
  • Save sygour/93bd129b213a73602f41 to your computer and use it in GitHub Desktop.
Save sygour/93bd129b213a73602f41 to your computer and use it in GitHub Desktop.
Useful SQL request
-- select the nth row of a table
-- from http://stackoverflow.com/questions/16568/how-to-select-the-nth-row-in-a-sql-database-table
SELECT * FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY key ASC) AS rownumber,
columns
FROM tablename
WHERE condition
) AS foo
WHERE rownumber = n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment