Select column names based on values in another table.
I'd like to generate a sql statement based on values from a table. For example, I'd like to run "Select division from tableA"
In the above example "division" would be a value of a column in TableB. Maybe looking like this.
Table B
Primary Key ColumnName
-----
-----
1234 Division
3456 Division
7890 Department
I would want to retrieve "Division" from Table B based on primary key = 1234 and then generate the above SQL.
Any ideas?
TIA