Tuesday, October 1, 2013

Need SQL script to get the 6 months data month wise

Try the below:(Not tested)



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





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