You are here: Re: Data grouped by 20 minutes? « MsSQL Server « IT news, forums, messages
Re: Data grouped by 20 minutes?

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)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация