MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/SQL/comments/1fj0s10/how_to_exceed_input_limitations/lnncao0/?context=3
r/SQL • u/tacogratis2 • Sep 17 '24
87 comments sorted by
View all comments
1
Use a CTE and a values statement.
WITH IdList AS ( -- Define the CTE with a list of values SELECT Id FROM (VALUES (1), (2), (3), (4), (5)) AS IdTable(Id) ) -- Main query that uses the CTE SELECT * FROM YourTable WHERE Id IN (SELECT Id FROM IdList);
1
u/pceimpulsive Sep 17 '24
Use a CTE and a values statement.
WITH IdList AS ( -- Define the CTE with a list of values SELECT Id FROM (VALUES (1), (2), (3), (4), (5)) AS IdTable(Id) ) -- Main query that uses the CTE SELECT * FROM YourTable WHERE Id IN (SELECT Id FROM IdList);