group by 15 minute interval sql server

Solutions on MaxInterview for group by 15 minute interval sql server by the best coders in the world

showing results for - "group by 15 minute interval sql server"
Lea
12 May 2019
1SELECT   DATEADD(MINUTE, DATEDIFF(MINUTE, '2000', aa.[date]) / 10 * 10, '2000')
2                                                             AS [date_truncated],
3         COUNT(*) AS [records_in_interval],
4         AVG(aa.[value]) AS [average_value]
5FROM     [friib].[dbo].[archive_analog] AS aa
6-- WHERE aa.[date] > '1900-01-01'
7GROUP BY DATEADD(MINUTE, DATEDIFF(MINUTE, '2000', aa.[date]) / 10 * 10, '2000')
8ORDER BY [date_truncated]
9
similar questions
queries leading to this page
group by 15 minute interval sql server