Using column values in another SQL query

Hi,
I am trying to use column value of one table in another SQL query as a flow variable . Something like below:
I have a table db1 which has column instance_id(of type string) and have converted into flow variable now I want to run another query like
Select * from db2table where serial in (instance_id)
my query looks like
select R.ex_no from
db2table R
where R.ext_no in β€˜$${S@ins_id}$$’

but getting error in the node -'there is no such variable like @ins_id but if we use without @, I get parantheses error.


Screen shots are attached

Hi,
I don’t think you can use a flow variable with multiple values as operand of an IN-statement like that. Could you maybe instead use a nested query here? Like that:
SELECT R.ex_no FROM db2table R WHERE R.ext_no IN (SELECT instance_id FROM ___ WHERE ___)
You can use the DB Query node to construct such a query.
Kind regards
Alexander

Hi there @analytics_sharma,

if I got you right have a look at Parameterized DB Query Reader node.

Br,
Ivan

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.