Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have data in below form

|User | Question           |    Answer     |
------------------------------------
|ra12 |what is your role? |    manager     |
|ra12 |What you like to be| Product Owner  |
|bas2 |what is your role? |    SMO         |
|bas2 |What you like to be| Project Manager  |

.
.
.

I need it in this form using sql query.

|User | what is your role?|What you like to be|
------------------------------------------------
|ra12 | manager           | Product Owner     |
|bas1 | SMO               | Project Manger    |



can anybody help me in this query. table name is tbl_survey.

Thank you in advance.
Posted
Comments
Andy Lanng 29-Oct-15 11:52am    
look up "pivot"
Maciej Los 29-Oct-15 12:03pm    
Sounds like an answer!
Andy Lanng 29-Oct-15 12:12pm    
Barely - far to lazy to be point-worthy - I know little about pivot myself
Maciej Los 29-Oct-15 12:16pm    
I'm not doing it for points (reputation)...

1 solution

As Andy Lanng[^] mentioned, you need to use Pivot[^]
 
Share this answer
 

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