WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=2 THEN '2.
FEB' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=3 THEN '
MAR' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=4 THEN '
APR' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=5 THEN '
MAY' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=6 THEN '
JUN' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=7 THEN '
JUL' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=8 THEN '
AUG' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=9 THEN '
SEP' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=10 THEN '
OCT' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=11 THEN '
NOV' WHEN MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00'))=12 THEN '
DEC' ELSE NULL END 'MONTH' FROM workorder wo
where wo.CREATEDTIME >= <from_thisyear> AND wo.CREATEDTIME <= <to_thisyear> group by serd.Name,reqtl.TEMPLATENAME,MONTH(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00')), YEAR(dateadd(s, datediff(s, GETUTCDATE(), getdate()) + (
wo.CREATEDTIME/1000), '1970-01-01 00:00:00')) order by 5,1 desc