Frequently asked questions - Base
From The Document Foundation Wiki
How can I limit the number of result rows from a query?
To limit the number of rows produced by a query to the first 'n', the query will look like this
- This type of command is written in SQL mode (it's not supported in draft mode). A good trick to avoid misspelling names is to start in draft mode to select tables and fields, then move to SQL mode to add the keyword TOP.
- As shown in the screen shot, you must press the "Execute SQL directly" button in the query editor.
- The order of the rows returned is defined by the query. In the example above the query is ordered alphabetically on the field "Nom". The three rows shown are the first three in that order.
- The corresponding SQL is :
SELECT TOP 3 "RéfClient", "Nom", "Prénom" FROM "Clients" ORDER BY "Nom"