Skip to content

Instantly share code, notes, and snippets.

@gracefullight
Created December 22, 2016 13:40
Show Gist options
  • Select an option

  • Save gracefullight/dca975838a021a6b180beec951babe6a to your computer and use it in GitHub Desktop.

Select an option

Save gracefullight/dca975838a021a6b180beec951babe6a to your computer and use it in GitHub Desktop.
SELECT SQL_CALC_FOUND_ROWS @RNUM:=@RNUM+1 AS ROWNUM, R.* FROM (
SELECT @RNUM:=0, Q.* FROM (
SELECT * FROM TABLE1
WHERE ID = '1'
ORDER BY REG DESC
LIMIT 18446744073709551615
) Q
) R
LIMIT 0,10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment