Reputation: 817
Here is my query:
SELECT * FROM table1
WHERE col1 IN (SELECT cola, colb, colc, cold FROM table2)
where all cols are of data type integer
. When I execute this query I get "sub query has too many columns". What whould be the right way to do this?
Upvotes: 0
Views: 669
Reputation: 248175
SELECT * FROM table1
WHERE col1 = ANY (
(SELECT array_agg(ARRAY[cola, colb, colc, cold])
FROM a
)::integer[]
);
Upvotes: 1