C
Casey P
How do I put in "Date Ranges" in a Query. I want to have the queries pull by
each month. Also want a query to give daily totals.
each month. Also want a query to give daily totals.
Casey said:How do I put in "Date Ranges" in a Query. I want to have the queries
pull by each month. Also want a query to give daily totals.
Rick Brandt said:Something like this works well if your Dates won't all have midnight (0) as
the time...
SELECT *
FROM TableName
WHERE DateField >= SomeDate
AND DateField < DateAdd("D", 1, SomeOtherDate)
If all dates have midnight as the time then the last line can become...
AND DateField <= SomeOtherDate
....or you could use BETWEEN instead.
To get daily totals use a GroupBy on your Date field (if all have midnight
as time) or on an expression that strips out the time (if some values are
not midnight) then use Sum on whatever field you want to total.
Casey said:What format should I use for the date?