Forum Discussion
yashsam
Jun 21, 2022Copper Contributor
Power Query: create sql dynamic match on multiple columns
Hi, I am looking to fetch data from DB using SQL containing a dynamic match on 5 columns from an input table in power query. Let me explain in details. Say I have a table like the below one where...
yashsam
Jun 22, 2022Copper Contributor
Thanks for offering to help 🙂
SELECT * city, store, category, line
FROM sample_table
WHERE city = 'Chennai'
OR city & store & category = 'ChennaiA100B5'
Looking to add one condition per row
In this case I understand the rows returned by the second condition is a subset of the first one. But it I expect a minimum of 30 different combinations when going live. Any of the fields could be left blank.
SELECT * city, store, category, line
FROM sample_table
WHERE city = 'Chennai'
OR city & store & category = 'ChennaiA100B5'
Looking to add one condition per row
In this case I understand the rows returned by the second condition is a subset of the first one. But it I expect a minimum of 30 different combinations when going live. Any of the fields could be left blank.