|
The task is to select invoices that was made between March and May 1999.
-- first way by definite date range (date format used is DD/MM/YYYY)
SELECT DocKey, CustomerName, DocTotal, DocDate
FROM Invoice
WHERE DocDate BETWEEN #01/03/1999# AND #30/05/1999#
|
-- second way using functions that retrieve Date subparts
SELECT DocKey, CustomerName, DocTotal, DocDate
FROM Invoice
WHERE Year(DocDate) = 1999 AND Month(DocDate) BETWEEN 3 AND 5
|
The query returns results like these:
| DocKey | CustomerName | DocTotal | DocDate |
| 103 | Jessica Simpson | 250 | 10/03/1999 |
| 104 | Erika Nass | 250 | 12/03/1999 |
| 105 | John Depp | 1750 | 02/04/1999 |
| 106 | Barbara Spears | 6900 | 17/05/1999 |
|