How to get Monthly Data in Sql Server

3 Comments | 1998 Views | Post by: Admin | Tags: How to get Monthly Data in Sql Server


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:

loading...