I got a couple of tables with rows and columns. In some there is an X and in some not. Now I would like to get all row-column pairs that have an X in there.
Is that possible with SQL? Would it be possible with somehow else?
One idea I had was using case
, but I would need to hard code all the col/row combinations.
Example
Table:
rowNo| col1 | col2 | colN
-----|------|------|----
row1 | X | |
row2 | X | X |
rowN | | |
Expected result:
| row | col |
| ----|---- |
| row1|col1 |
| row2|col1 |
| row2|col2 |