Customer Order Monthly Report Using Pivot In SQL Server

Total Post:341

Points:2389
 897  View(s)
Ratings:
Rate this:
 I want to Customer Order Monthly Report Using Pivot In SQL Server Please help me

  1. Post:279

    Points:1987
    Re: Customer Order Monthly Report Using Pivot In SQL Server

    Pivot query help us to generate an interactive table that quickly combines and compares large amounts of data. We can rotate its rows and columns to see different summaries of the source data, and we can display the details for areas of interest at a glance. It also help us to generate Multidimensional reporting.

      SELECT * FROM (    
            SELECT c.CustomerName, CONVERT(CHAR(4), d.Orderdate, 100)  as [month],   
                ISNULL(d.amount,0) AS Amount   
                FROM [Order] d RIGHT JOIN Customer c   
                ON d.CustomerID=c.CustomerID)   
                AS s  PIVOT ( SUM(Amount)   
                FOR [Month] in (Jan, Feb, Mar, Apr, May, June, Jul, 
                                 Aug, Sep, October, Nov, Dec)
            ) as CustomerOrder order by CustomerName

      Modified On Apr-10-2018 06:27:46 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!