-
help on query pivot...
hi,
I've table TAB_QUESTION:
ID_QUESTION..........VALUE_ID..........NUM_ANSWER......DESC_ANSWER
XB1.................1...................0..............YES
XB1.................2...................0..............NO
XB1.................3...................1..............GOOD
XB1.................4...................0..............SUFF
XB1.................5...................1..............NO_GOOD
XB1.................6...................0..............NR
XB1.................7...................0..............NN
YB1.................1...................1..............YES
YB1.................2...................2..............NO
YB1.................3...................3..............GOOD
YB1.................4...................0..............SUFF
YB1.................5...................3..............NO_GOOD
YB1.................6...................2..............NR
YB1.................7...................1..............NN
ZC1.................1...................0..............YES
ZC1.................2...................0..............NO
ZC1.................3...................0..............GOOD
ZC1.................4...................0..............SUFF
ZC1.................5...................0..............NO_GOOD
ZC1.................6...................0..............NR
ZC1.................7...................1..............NN
TC1.................1...................1..............YES
TC1.................2...................1..............NO
TC1.................3...................1..............GOOD
TC1.................4...................1..............SUFF
TC1.................5...................1..............NO_GOOD
TC1.................6...................0..............NR
TC1.................7...................0..............NN
..........................................................
..........................................................
I've always JUST 7 (seven) DESC_ANSWER (YES,NO,GOOD,SUFF,NO_GOOD,NR,NN)
Now I'd like to have ID_QUESTION like columns and DESC_ANSWER like rows.
like this:
DESC_ANSWER..........XB1........YB1............ZC1........TC1
YES..............................0..........1..............0...........1
NO................................0..........2..............0...........1
GOOD...........................1..........3..............0...........1
SUFF............................0..........0..............0...........1
NO_GOOD....................1..........3..............0...........1
NR................................0..........2..............0...........0
NN................................0..........1..............1...........0
How Can I write this query to get this output??
Thanks in advance!
-
"The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|