|
-
Jul 13th, 2001, 05:34 PM
#1
Thread Starter
New Member
SQL Server opposite of join?
What is the opposite of join in sql server 7 and how do I use it? I have two tables and I want to pull the records that are in one table but not in the other. I know in paradox its count = 0 but i cant figure it out for sql.
-
Jul 13th, 2001, 05:54 PM
#2
You can do something like this:
Code:
select * from t1 where t1.keyfield not in (select t2.keyfield from t2)
"It's cold gin time again ..."
Check out my website here.
-
Jul 13th, 2001, 05:58 PM
#3
Hyperactive Member
You could also use:
Code:
SELECT tableA.fieldname
FROM tableA
LEFT OUTER JOIN tableB
ON tableA.fieldname = tableB.fieldname
WHERE tableB.fieldname is null
Assuming your comparison fields are indexed, this is kinder to your server than using an IN clause on larger tables. Hope it helps.
Last edited by Mongo; Jul 13th, 2001 at 06:04 PM.
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
|