Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Iterate through a table to use with WHERE

Author  Topic 

Darkmatter5
Starting Member

17 Posts

Posted - 2012-10-23 : 17:19:54
If I have a table that has a list of IDs, how can I run a query that has a WHERE clause that can iterate through the first table?

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-23 : 17:49:11
Rather than iterating through the table consider doing a set based query like below:
SELECT
y.*
FROM
YourTable y
INNER JOIN YourIdTable i ON
i.ID = y.ID;
Go to Top of Page
   

- Advertisement -