PIVOT two columns SQL Server -




i've been trying use pivot feature query how not able find solution. below main table criteria.

evaluationid  criteria  overallrating     1            c1         bad     2            c2         

now each criteria has few questions , answers.

id  evaluationid    questiontext    ratingtext 1     1                 q1          unsatisfactory 2     1                 q2          unsatisfactory 3     1                 q3          unsatisfactory 4     2                 q4          bad 5     2                 q5          

my desired result below.

evaluationid   question  answer   question  answer    question   answer    1           q1        unsati..  q2       unsati..   q3        unsati..    2           q4        bad       q5             null      null 

important aspect here there multiple criteria , number of questions in each criteria can vary.

can help?

thanks





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -