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
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
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.