SQL | SQL SERVER | Group by Minutes

In order to group the data with 10 minutes bucket of date,
use following SQL:


Group by 10 Minutes
SQL Server


select count(*),
DATEADD(MINUTE, DATEDIFF(MINUTE, '2000', SUBMITTEDDATETIME) / 10 * 10, '2000') AS [date_truncated] from ThawTable where 
cast(ThawingDate  as date) = cast('2022-03-21' as date)
and THAWQTY <> 0
 group by status,DATEDIFF(MINUTE, '2000', SUBMITTEDDATETIME) / 10
order by 1 desc;


Comments

Popular posts from this blog

Command Line tool for Android and iOS [ adb and cfgutil ]

Convert Chrome recording to Vugen Script

Jmeter-CheatSheet