Thursday, December 26, 2013

Need SQL script to get the 6 months data month wise

Try the below:(Not tested)



select DATENAME(Month,dateoftransaction),SUM(empcount) from tablename
where dateoftransaction > dateadd (MONTH, -6, GETDATE())
Group by DATENAME(Month,dateoftransaction)





Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.



No comments:

Post a Comment