|
Posted by Hugo Kornelis on 11/30/05 02:09
On 28 Nov 2005 08:45:35 -0800, Vidya wrote:
>Hi,
>I want to get the count of rows per each 20 minutes, is that possible?
>
>Is there a date function or any other function that I can use in Group
>by clause, which will group the data of every 20 minutes and give me
>the count?
Hi Vidya,
SELECT a, b,
DATEADD(minute,
20 * (DATEDIFF(minute, '20050101', theDate) / 20),
'20050101') AS StartOf20Mins,
COUNT(*), SUM(Column)
FROM YourTable
GROUP BY a, b, DATEDIFF(minute, '20050101', theDate) / 20
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
[Back to original message]
|