Let say I have the next table:
ID_1 | ID_2 | Value |
---|---|---|
1 | 11 | A |
2 | 12 | A |
2 | 13 | A |
2 | 13 | B |
3 | 12 | A |
3 | 13 | B |
I want to transform it to:
ID_1 | ID_2 | Value_A | Value_B |
---|---|---|---|
1 | 11 | 1 | 0 |
2 | 12 | 1 | 0 |
2 | 13 | 1 | 1 |
3 | 12 | 1 | 0 |
3 | 13 | 0 | 1 |
- When there is a value A but no Value B, so put 0 in Value B
- When there is a value B but no Value A, so put 0 in Value A
How can I do it in oracle?