Forum Discussion
darylmc
7 years agoFrequent Visitor
SQL server - joins on multiple columns
Hi All, I'm attempting to join tables on multiple columns using SQL. For some reason, it doesn't like when attempt to join table d on multiple columns (fine if just one). What is the correct code...
- 7 years ago
darylmc As v-chuncz-msft mentioned it is not the right community for this. As this is for Power BI stuff.
Anyway, as I can see in your query that you are trying to join the fields from d (an alias table) which are not present in the SELECT clause. Even though that table might have those fields but you are selection is restricted to the subset of fields and the join performing outside this will know or can access those fields in SELECT statement alone. So you need to have geography_id,calendar_id and merchandising_id in your select statement of d.
Hope this clarifies your issue.
v-chuncz-msft
7 years agoCommunity Support