Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Using Pivot In SQL for Reporting

By , 11 Mar 2011
Rate this:
Please Sign up or sign in to vote.
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 ,l.Requested_By as requester
                FROM mms_store_requisition  l inner join
                mms_store_requisition_detail  m on l.SR_No=m.SR_No
                inner join mms_material  n on m.material_code=n.material_code
                where l.Prepared_Date between '1966-01-01' and '2003-12-12'
                order by m.Status, m.Material_Code)  request
                inner join (select t1.emp_Id as employee,t1.department_id
                ,t2.description as Requestion_Department
                from hr_employee_info t1 inner join tbl_department t2
                on t1.department_id=t2.department_id)  empInfo
                on request.requester=empInfo.employee


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

Comments and Discussions

Generalhi Feleke, I could not find this as alternate of pivoting co... Pinmembercode in play11-Mar-11 2:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 11 Mar 2011
Article Copyright 2011 by Feleke Feyissa
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid