Consider following table
--------------------------------
ID | ColA | ColB | ColC
--------------------------------
1 | ABC | |
2 | | XYZ |
3 | PQR | |
4 | MNO | PQR |
I need to get the first free column of the table where ID = 1. How can I do that
For example:
If ID = 1, next free column is ColB
If ID = 2, next free column is ColA
If ID = 3, next free column is ColB
If ID = 4, next free column is ColC
if you want the name of the column you can do something like:
or case