Quantcast
Channel: How to select the nth row in a SQL database table? - Stack Overflow
Viewing all articles
Browse latest Browse all 35

Answer by Ellen Teapot for How to select the nth row in a SQL database table?

$
0
0

I'm not sure about any of the rest, but I know SQLite and MySQL don't have any "default" row ordering. In those two dialects, at least, the following snippet grabs the 15th entry from the_table, sorting by the date/time it was added:

SELECT * FROM the_table ORDER BY added DESC LIMIT 1,15

(of course, you'd need to have an added DATETIME field, and set it to the date/time that entry was added...)


Viewing all articles
Browse latest Browse all 35


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>