Can I use WHERE Col1 IN (SELECT *something*)?

Hello

Can I do the following?

SELECT *
FROM Table1
WHERE Col1 IN (SELECT Col2,Col3 FROM Table2 WHERE Col4='Y')

I want to filter the results where the Col1 exists in the two-dimension array that the SELECT Col2, Col3... statement returns.

Thanks!

SELECT *
FROM Table1 T1
WHERE EXISTS
(
	SELECT 1
	FROM Table2 T2
	WHERE T2.Col4 = 'Y'
		AND T1.Col1 IN (T2.Col2, T2.Col3)
);
1 Like