I have a table with about 30 columns. The columns can have values of X,N,C,D. Is there a way short of writing individual case statements to scan all the columns for a specific value, in this case C, and if a column does have that value in a row then output the column name to a new column? So for instance:
COL1| COL2 |COL3....|COL30 |NEW_COL
'X' | 'C' | 'N' | 'D' | 'COL2'
Where Column2 in this row has the value I'm searching for, 'C', so the value of 'New_column' is 'COL2'.
Hopefully that makes sense. Thanks for all your time!