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: MySql Query help



Try this pseudo SQL code below

SELECT SUM(<col>) FROM <table> WHERE <col datetime>
BETWEEN
'<starttime>' AND '<endtime>'

You have the formatting of the times correct for it to work

Have a look at the BETWEEN on the MySQL support docs
http://dev.mysql.com/doc/refman/4.1/en/comparison-operators.html

On 04/01/06, Paul Smith <ukha@xxxxxxx> wrote:
> Hi Guys,
>
>
>
>            I've been dumping meter readings into a simple mysql
> database. Basically every minute the number of flashes the meter makes
> is recorded, along with the date-time of the entry.
>
>
>
> A while back I had some help getting out hourly and daily totals which
I
> use to create my live charts. However it dawned on me last night that
if
> I know the time at which the cheap rate switches in I then already
have
> the data in the date base.
>
>
>
> So what I am looking to do is sum up the minute readings between 00:30
> and 07:30 and call that Cheap and then the rest as Normal. In the past
I
> have only had to sum up one total which makes life very easy to do
hours
> or days or month or years, but with this added requirement I am
getting
> very confused.
>
>
>
> Any one care to point me in the right direction.
>
>
>
>
>
> Regards,
>
>
>
>
>
> Paul
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>





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.