Frequently asked questions - Base

From The Document Foundation Wiki
< Faq‎ | Base
Jump to navigation Jump to search
Other languages:
Deutsch • ‎English • ‎français • ‎italiano

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

To select the first three rows


  1. 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.
  2. As shown in the screen shot, you must press the "Execute SQL directly" button in the query editor.
  3. 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"