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


  • Subject: RE: Sql help, for electronic meter reading
  • From: "Paul Smith" <ukha@xxxxxxxxxxxxx>
  • Date: Tue, 29 Mar 2005 14:04:12 +0100


Hi Doogie,

That's the baby, just need to work out the syntax as mysql
doesn't like it.

Many thanks


Paul


-----Original Message-----
From: Doogie Brodie [mailto:ukhad@xxxxxxx]
Sent: 29 March 2005 13:44
To: ukha_d@xxxxxxx
Subject: Re: [ukha_d] 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.