On 29-Aug-2001 Morten Søndergaard wrote:
> i have a tabel whit 5 min counting
>
> Id CntDateTime Cnt1
> 1 2001-08-01 00:05:00 12
> 2 2001-08-01 00:10:00 11
> 3 2001-08-01 00:15:00 10
> 4 2001-08-01 00:20:00 0
> 5 2001-08-01 00:25:00 6
> 6 2001-08-01 00:30:00 14
> 7 2001-08-01 00:35:00 11
> .
> .
> What i want is to make a Select/group by, so tha i do have 15. min.
> countings
>
> The Resultatet of my SELECT shall be:
>
> CntDateTime Cnt1
> 2001-08-01 00:05:00 33
> 2001-08-01 00:20:00 20
> 2001-08-01 00:35:00 xx
>
>
> It can be made in acces whit this sql-string
>
> SELECT Sum([CountTabel].[cnt1]) AS hmm, Year([CntDateTime]) &
> Month([CntDateTime]) & Day([CntDateTime]) & Hour([CntDateTime]) &
> Minute([CntDateTime])-(Minute([CntDateTime]) Mod 15)
> FROM CountTabel
> GROUP BY (Year([CntDateTime]) & Month([CntDateTime]) & Day([CntDateTime]) &
> Hour([CntDateTime]) & Minute([CntDateTime])-(Minute([CntDateTime]) Mod 15));
>
> Can anybody translate it to a working SQL-statement
>
>
try :
select concat(left(CntDateTime,14), round(minute(CntDateTime) /15) *15) as dt,
sum(Cnt1) as cnt fromo foo group by dt;
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php