I want to select specific columns from a table, let's say table A. Table B has the names of the names of the columns I would like to select. How would I write a MSSQL query that will use the distinct values from Table B as the column names that I want to query from table A?
Sql-server – Select using values from another table
sql server
Related Question
- Sql-server – Update table using values from another table in SQL Server
- Sql-server – SQL Server – Copying a key from one table to another
- Sql-server – Generate wide table from lookup values
- Sql-server – SQL Server – Select where using split – without declaring function
- Sql-server – Aggragate values over time in temporal table
- Sql-server – Pattern for copying hierarchical data from one table to another
Best Answer
Can't you just use the COALESCE function like this?