Click here to Skip to main content
Click here to Skip to main content

Using Pivot In SQL for Reporting

select * from(SELECT l.Prepared_Date as Prepared_Date , m.Material_Code as Material_Code ,n.Name as Name,n.Description as Description , m.Quantity as Quantity,n.Unit_Of_Measure as Unit_Of_Measure , m.Status as Status...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

28 Feb 2011
code in play
2 alternatives  
Nice and fast way for reporting
15 Mar 2011
Kannan K R
select ExDate, SUM(case when Dept='A' then expense else 0 end)[Store A Expense],SUM(case when Dept='B' then expense else 0 end)[Store B Expense],SUM(case when Dept='C' then expense else 0 end)[Store C Expense]from expenseTable where Dept in ('A','B','C') group by ExDate

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Feleke Feyissa

United States United States
No Biography provided

| | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 11 Mar 2011
Article Copyright 2011 by Feleke Feyissa
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid