How to get Monthly Data in Sql Server

  MSSQLSERVER   Friday, June 12, 2015   3321 | 1 Comment | No Download | No Demo | Pawan kumar
 Tags: How to get Monthly Data in Sql Server 


SELECT *
FROM (
    SELECT 
        year(Addeddate) as [year],left(datename(month,Addeddate),3)as [month], 
        AmountPaid as Amount 
    FROM Invoice
) as s
PIVOT
(
    SUM(Amount)
    FOR [month] IN (jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, [dec])
) AS PVTTable

 


Post Comments

if you have some suggestion, question, request on How to get Monthly Data in Sql Server.

Please use the comment box to express your views.

 

Comments: