Click here to Skip to main content
15,898,010 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello Friends,

I have a requirement that to show hierarchical records into the single record.
like i have table table1 with data:


emp_id old_status new status 
1      A          B
1      B          C
1      C          D
2      A          B
2      B          C
2      C          D
2      D          E


I want to show records in following manner:


emp_id status1 status2 status3 status4 status5
1      A       B       C       D
2      A       B       C       D    E


Thanks in advance
Rohan Lokhande
Posted
Updated 7-Apr-13 7:11am
v2
Comments
Zoltán Zörgő 7-Apr-13 13:14pm    
You have a really important field missing: the order of these records.
Can there be more than 5 status values?
[no name] 7-Apr-13 13:15pm    
You would use a PIVOT.
Maciej Los 7-Apr-13 13:35pm    
Which aggregate function (MAX, COUNT, SUM) you'll use?

;)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900