Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SQL Server loop in SProc to generate query
- SELECT col1
- FROM table1
- WHERE col2 = 1
- INTERSECT
- SELECT col1
- FROM table1
- WHERE col2 = 2
- INTERSECT
- SELECT col1
- FROM table1
- WHERE col2 = 3
- SELECT col1
- FROM table1 t
- INNER JOIN
- #temp v
- ON (t.col2 = v.col2)
- GROUP BY
- col1
- HAVING COUNT(*) = (SELECT COUNT(*) FROM #temp)
Add Comment
Please, Sign In to add comment