1

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!

user194076
  • 8,557
  • 22
  • 84
  • 150

2 Answers2

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
  • 102,799
  • 24
  • 193
  • 261
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,390
  • 13
  • 15