Frequently asked questions - Base

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

How can I select dates within a range?

  • Starting with a field holding dates, select entries between a given start and end date.

The query will look like this:

To select dates between 01/05//2011 and 31/05/2011


  1. In Draft mode the dates have to be in the format DD/MM/YY (the computer will format this as DD/MM/YYYY after validation)
  2. In SQL mode the dates must be in the format {D 'YYYY-MM-DD'}

SELECT "RéfCommande", "DateCommande" FROM "Commandes" WHERE "DateCommande" BETWEEN {D '2011-05-01' } AND {D '2011-12-31' }

  • An alternative technique is to enter two tests against the date field to test the start and end dates separately:

To select dates between 01/05/2011 and 31/05/2011


  1. It is helpful to make only one of the two date columns visible (by checking the Visible checkbox)
  2. Use the operators >= and <= respectively for "greater than or equal to " and "less than or equal to"