J'ai une table tblUser
, avec des colonnesComment convertir des lignes de données en colonnes?
userId,firstName,LastName,Mobile,.......,QuestionID
je une autre table son nom tblResults
, avec ces colonnes
questionID,Question,choiceID,choice,.........
tblUser
-----------------------------------------------------------------------------
userID - FirstName- LstName -Mobile ... ... ... - QuestionID - ChiceID
-----------------------------------------------------------------------------
001 - xx - yy - 03212 - 01 01
001 - xx - yy - 03212 - 02 02
002 - xxx - yyy - 03425 - 01 02
002 - xxx - yyy - 03425 - 02 01
003 - xxxx - yyyy - 03429 - 03 02
003 - xxxx - yyyy - 03429 - 03 01
------------------------------------------------------------------------------
tblResults
---------------------------------------------------------------------
QuestionID Question ChoiceID Chice .... ....
---------------------------------------------------------------------
01 - **Are you** - 01 - Male
01 - **Areyou** - 02 - Female
02 - **From** - 01 - xxxxx
02 - **FROM** - 02 - yyyyy
---------------------------------------------------------------------
Je veux obtenir le résultat indiqué dans la suite table
-------------------------------------------------------------------------------
UserID FirstName LastName Mobile **Areyou** **From**
-------------------------------------------------------------------------------
001 - xx - yy - 03212 - Male - yyyyy
002 - xxx - yyy - 03425 - Female - xxxxx
003 - xxxx - yyyy - 03429 - Female - xxxxx