The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Sql help, for electronic meter reading




Paul Smith wrote:
> SELECT Sum(reading) AS Reading FROM `electric` where Date between
> '2005-03-29 12:00:00' and '2005-03-29 13:00:00'

using your stuff, try......

Select datepart(hour,Date) as ReadingHour, sum(reading) as Reading
FROM 'electric' where Date between
'2005-03-29' and '2005-03-30'
GROUP BY Datepart(Hour,Date)

Which should give you an hour by hour sum of readings for the whole day
(ie, not cumulative)..... this should give you an output of:-

ReadingHour	Reading
0		10
1		10
2		25
...
23		100


is that what you wanted?

Cheers
--
Doogie



UKHA_D Main Index | UKHA_D Thread Index | UKHA_D Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.