I have two tables as below that I am looking to join dynamically using the ColVal in TMaster with ColName in TMaster which is the name of the column to match with in TTable1.
TMaster:
TTable1:
So, final result would be the data from TTable1 that matches the colName and ColVal in TMaster. How do I achieve this?
select tt.Name
from TMaster tm
join TTable1 tt on TMaster.ColVal = tt.[ColName from TMaster should be used here]