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'
Comments