sql select in (), with arguments from xls sheet

kkalomiris

New member
Joined
Dec 22, 2016
Messages
5
Reaction score
0
Points
0
Excel Version(s)
365
Hi,
I use power query to access data from my Oracle DB for various tests.
This is a simple query I use,
Select * from test where id in ('1','2')

So I want to retrieve the arguments of this select, '1','2', from a row of data with many values which I have it in my xls, 'sheet1'!A:A, instead of hardcoding them into the select

Like the below pseudo-syntax
Select * from test where id in (' "'sheet1'!A:A" ')


Thank you in advance
 
Enter the ids in a Table and then use power query to concatenate them into a string.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"id", type text}}),
    Concat = "'" & Text.Combine(#"Changed Type"[id], "','") & "'"
in
    Concat
 
Back
Top