How to use LIMIT and ORDER BY in sqlite

  Uncategorized

To get the first 10 in descending order in sqlite


SELECT * FROM table ORDER BY id DESC LIMIT 10

To get the first 10 in ascending order in sqlite


SELECT * FROM table ORDER BY id ASC LIMIT 10

Note: If there are less than 10 entrys in the sqlite database, you will get less than 10 results.