1
Answer

Pivot Table in SQL

Rajeev Jha

Rajeev Jha

12y
1.2k
1
Hi,
please view the sample data: 

EmpCode Att_Date Duration_HR Duration_Mn Remarks NoOfLeaves
750 10/01/2012 9 25 Null 0
751 10/01/2012 8 50 Late 0
752 10/01/2012 9 8 A 0
750 10/02/2012 10 2 Null 0
752 10/02/2012 8 0 Late 0
753 10/02/2012 Null Null Null 1

I want to have this data in following

10/01/2012 10/02/2013
750 750
9:25 10:02
Null Null
0 0
751 752
8:50 8:00
Late Late
0 0
752 753
9:08 Null
A Null
0 Null

I am trying to go with Pivot, but not able to get the perfect output. I will get the date range and EmpCode at runtime(from user).
Answers (1)