0

I'm fetching data through an SQL statement in PowerQuery:

let
    Source = Oracle.Database("sampleDB", [Query="SELECT * FROM mySampleTable WHERE CustomerID in (1,2,3,4,5)"])
in
    Source

I need the SQL filter to be dynamic. So I have another query with a single cell containing a text string. For the example above, the single cell looks like => "1,2,3,4,5". This is why I want to build a dynamic SQL statement in PowerQuery that references that single cell from my other query.

I've tried the code below and other variants but none work!:

let
    Source = Oracle.Database("sampleDB", [Query="SELECT * FROM mySampleTable WHERE CustomerID IN (" & MyReferenceQuery["SingleCell"] & ")"]
in
    Source  

How can I reference this other query?

1 Answer 1

1

If the text is in a single cell in a table, you need to access the value by specifying a column and a row-index, like below:

= Oracle.Database("sampleDB", [Query = "SELECT " & MyReferenceQuery[Column1]{0} & " FROM Table"])

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.