|
-
That's because you have it structured wrong. When you have tables in the FROM clause, you must join them in the WHERE clause or suffer cartesian joins. Do the math 
1 Table: 100 rows
2 Tables: 100 * 100 = 10,000 rows
3 Tables: 100 * 100 * 100 = 1,000,000 rows
4 Tables: 100 * 100 * 100 * 100 = 100,000,000 rows
You problem, as stated, actually has no inteest in joining these tables. What you appear to be trying to do can be accomplished through:
SELECT
---u.UserID
FROM
---table1 u
where
---u.user_id = 1---AND
---(
------exists ( select 1 from table2 r where r.user_id = u.user_id) OR
------exists ( select 1 from table3 s where s.user_id = u.user_id) OR
------exists ( select 1 from table4 t where t.user_id = u.user_id) OR
------exists ( select 1 from table5 g where g.user_id = u.user_id)
---)
HTH,
- Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|