Answers for "group by 15 minute interval sql server"

SQL
0

group by 15 minute interval sql server

SELECT   DATEADD(MINUTE, DATEDIFF(MINUTE, '2000', aa.[date]) / 10 * 10, '2000')
                                                             AS [date_truncated],
         COUNT(*) AS [records_in_interval],
         AVG(aa.[value]) AS [average_value]
FROM     [friib].[dbo].[archive_analog] AS aa
-- WHERE aa.[date] > '1900-01-01'
GROUP BY DATEADD(MINUTE, DATEDIFF(MINUTE, '2000', aa.[date]) / 10 * 10, '2000')
ORDER BY [date_truncated]
Posted by: Guest on September-21-2021

Code answers related to "group by 15 minute interval sql server"

Code answers related to "SQL"

Browse Popular Code Answers by Language