English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am trying to write a query in Access. The function would be similar to selecting from a table: all milk that has been sold, and all milk that has not been sold but expirationdate was between today and 7 days before today.

I don't really know how to use the getdate() function in the where clause

Thanks in advance

2007-03-14 02:45:47 · 2 answers · asked by lingt69 3 in Computers & Internet Programming & Design

2 answers

The code will be something like

Where Date_Column >=DATE()
and Date_Column <= Date() + 7

2007-03-14 02:52:40 · answer #1 · answered by AnalProgrammer 7 · 1 1

Use Today()

First Sum the number of milk on hand in that date range and place that into a variable.

For example: Sum * Where ItemDesc = "MILK" and Inventorydate >= (Today() - 7) to NUMVAR1.

Then sum the number sold in a similar manner and place that into a different variable. Then subtract NUMVAR1 from NUMVAR2.

2007-03-14 10:31:58 · answer #2 · answered by Sane 6 · 0 0

fedest.com, questions and answers