Multiple rows into variable
608221Nov 13 2007 — edited Nov 13 2007Hi,
Is there a way to store result of SQL query that returns multiple rows to a variable and then use that variable in the another query as part of the IN query?
I am using this in a stored procedure.
Simplified example of how it should work:
1. First query selects one column from multiple rows.
SELECT row_id INTO some_variable FROM some_table;
-row_id column is integer type.
2. Next query uses some_variable
SELECT * FROM another_table WHERE row_id IN (some_variable);
Thanks