SELECT 'EVENT' AS 'table_name' ,
datepart(yy, A.[TIMESTAMP]) AS 'yy' ,
datepart(mm, A.[TIMESTAMP]) AS 'mm' ,
datepart(dd, A.[TIMESTAMP]) AS 'dd' ,
count(*) AS 'count'
FROM [dbo].[EVENT] AS A
WHERE A.[TIMESTAMP] >= '2017-01-01'
GROUP BY datepart(yy, A.[TIMESTAMP]) ,
datepart(mm, A.[TIMESTAMP]),
datepart(dd, A.[TIMESTAMP])
order by
datepart(yy, A.[TIMESTAMP]) ,
datepart(mm, A.[TIMESTAMP]) ,
datepart(dd, A.[TIMESTAMP])