목록공부/DB (1)
Been_DevStep
[MSSql] 시간별로 횟수 검색
select Case WHEN LEN(CAST(DATEPART(Hour, input_time) as varchar))> 1 THEN CAST(DATEPART(Hour, input_time) as varchar) ELSE '0' + CAST(DATEPART(Hour, input_time) as varchar) end + ':00' as 'hour', COUNT('hour') as 'count' from Serial_Bcr1 Group by CAST(DATEPART(Hour, input_time) as varchar) order by 'hour'
공부/DB
2023. 3. 20. 13:20