I am using Access 2010 and trying to create a query to count records by hour. The fields in the table include:
EnterDate, EnterTime, ExitTime, Type
I need to count the number of vehicles that enter and exit per hour on a given day and show by type.
My SQL is as follows:
But I am not getting the results I want. Can anyone steer me in the right direction? Thank you!
EnterDate, EnterTime, ExitTime, Type
I need to count the number of vehicles that enter and exit per hour on a given day and show by type.
My SQL is as follows:
Code:
SELECT VehicleLogDay.EnterDate, Hour([EnterTime]) AS InHour, Count(VehicleLogDay.EnterTime) AS TotalInPerHour, Hour([ExitTime]) AS OutHour, Count(VehicleLogDay.ExitTime) AS TotalOutPerHour, VehicleLogDay.Type
FROM VehicleLogDay
GROUP BY VehicleLogDay.EnterDate, Hour([EnterTime]), Hour([ExitTime]), VehicleLogDay.Type
HAVING (((VehicleLogDay.EnterDate)=[Forms]![frmMain]![DaysDate]))
ORDER BY Hour([EnterTime]), Hour([ExitTime]);
But I am not getting the results I want. Can anyone steer me in the right direction? Thank you!