CumbrianCanary
04-30-2009, 07:36 AM
I have a database that holds a reading every ten minutes. I have been asked to sum them to give hourly and daily values.
I have easliy created a query to get the daily totals but can't seem to get the hourly ones.
The table has 3 fields, date, time and reading.
I am missing something really obvious here?
Thanks in advance for your help
ajetrumpet
04-30-2009, 07:59 AM
look here first: http://www.access-programmers.co.uk/forums/showthread.php?t=157264&highlight=query+previous
for hourlies, you can probably just manipulate the code that is in that database of mine, if you can do it.
one other point...do not use reserved words as field names. You have two: DATE and TIME. PLEASE CHANGE THESE.
raskew
04-30-2009, 08:03 AM
Hi -
Give this a try, changing table/field names as appropriate.
Note: DATE, TIME and HOUR are all reserved words in Access and should not be used as field names.
Strongly recommend you rename your Date and Time fields.
SELECT
tblReadings.MyDate
, Hour([MyTime]) AS MyHour
, Sum(tblReadings.Reading) AS SumOfReading
FROM
tblReadings
GROUP BY
tblReadings.MyDate
, Hour([MyTime]);
HTH - Bob
CumbrianCanary
04-30-2009, 08:25 AM
Thanks for your help guys. The fields aren't really called time and date, I just used that to indicated the information they held.