select substring(DATENAME(Month,dateoftransaction),1,3)+'-' + cast(SUM(empcount) as varchar) from @t
where dateoftransaction > dateadd (MONTH, -6, GETDATE())
and DATEPART(year, dateoftransaction)<=DATEPART(year, GETDATE())
Group by DATEPART(year, dateoftransaction), DATENAME(Month,dateoftransaction)
ESHANI. Please click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you
No comments:
Post a Comment