Вывод количества талонов по дням за квартал
select
datepart(hour, DateTime) as 'час выдачи талона',
count (*) as 'количество талонов'
from Damask2017.dbo.Terminal
where (DateTime between '2017-04-01 00:00:00' and '2017-06-31 23:00:00')
group by DATEPART(hour, DateTime)
order by 1