Forum Discussion
Use a parameter in a query in a MySQL database
- 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
Hi Alicia
Perhaps there is another way, you could put the whole SELECT clause for the ID's into the WHERE clause on the other query
= MySQL.Database(Server,Database,[Query="select ... from ... where id in (select id from mytable )", CommandTimeout=#duration(0, 16, 40, 0), ReturnSingleDatabase=true])
Mike
Hi Mike,
Thank you for your suggestion but the two queries are not launched on the same database.
Edit : Finally it was a problem of options, I have to select "Always ignore Privacy Level Settings" in Options -> Options and settings -> Privacy
Thank you for your help !!
Alicia