Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query / group by date that isn't from 00:00 to 00:00 1

Status
Not open for further replies.

rxsims

Technical User
Jul 14, 2003
34
CA
How do I query and group data for a period of time greater than one day when the I want the 'days' to be grouped from another time, i.e. 05:00 to 05:00 every day instead of 00:00 to 00:00?
 
Specify the time too. e.g.

SELECT .... WHERE MyDate BETWEEN #1/1/80 05:00:00# AND #1/2/80 05:00:00#

Either that, or add/delete 5 hours to all of your dates within your query to 'shift' the working day.
 
Thanks. When I add the times to the Select.. statement, I think that will only group for the first day and last day, but all the days in between will be from 00:00 to 00:00. I'll try shifting the times. I will have to shift the time backward 5 hours in a query and shift them forward again in the report.
Thanks again.
 
You don't need to shift all of your dates - you could just do it within the WHERE clause. e.g.

SELECT MyDate FROM MyTable WHERE DateAdd("h",5,MyDate) BETWEEN #01/01/80 05:00:00# AND #01/02/80 05:00:00#

Then you will not need to shift them back in your form/report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top