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,787
  • 23
  • 94
  • 154

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
  • 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