Forum Discussion

alicia57's avatar
alicia57
Helper I
9 years ago
Solved

Use a parameter in a query in a MySQL database

Hello,   I would like to use a list of results from a first query in a second one.   I launch a first query on a SQL Server database. I click on a column "id" and "Add as New Query", then "New Pa...
  • mmanwaring's avatar
    mmanwaring
    9 years ago

    Hi

    because tx_id is a series of id numbers you need to pass them into SQL in a format it expects.

    I used Text.Combine to create my parameter so it read '123','124','125' which is what i needed to pass to the SQL where clause. As you are using a number then i do not think you need the '' so you need to pass into SQL IN clause (123,123,123,123) etc if tx_id looks like 123,123,123,123 then you can concatenate it into your SQL like your example.

    So the key to solving this is to make sure that tx_id results look exactly what SQL requires.

    Regards

    Mike