Pardon for the title I cant seem to figure out what could I do. I have a MainTable
that have some columns that is defined in another table DefTable
Simplified because this columns runs from Col1
to Col99
MainTable
RowId Col1 Col2 Col3 Col4
----- ---- ---- ---- ----
1 Y N N N
2 N Y N N
3 N N N Y
DefTable
Key Description
--- -----------
1 Logistics
2 Warehouse
3 Packaging
4 MainLobby
Condition is:
If a column is tagged Y
I should display the Description
according to its key in the DefTable
Also I'm looking into the possibility of two or more Columns are ticked Y
. If that happens. I should Concatenate
the results like Logistics, MainLobby
Expected output
RowId Description
----- -----------
1 Logistics
2 Warehouse
3 MainLobby
Possibility of multiple ticked columns
RowId Description
----- -----------
1 Warehouse, MainLobby
I have been tinkering this answer but I'm still stuck. Please help me.