I have base table with 1000 values. and second temporary table with 100 values. I need to compare them by guids and return only those rows from second table that do not exist in first table. I need the fastest performance solution for that. Thanks!
Asked
Active
Viewed 7,489 times
2 Answers
10
The classic left join/isnull test
select A.*
from secondTbl A
left join firstTbl B on A.guid = B.guid
WHERE B.guid is null

RichardTheKiwi
- 105,798
- 26
- 196
- 262
1
SELECT * FROM Table2 WHERE
NOT EXISTS (SELECT 'x' FROM table1 where
table1.field= table2.field)
http://weblogs.sqlteam.com/mladenp/archive/2007/05/18/60210.aspx

clyc
- 2,420
- 14
- 15