I have base table with 1000 values. and second temporary table with 100 val开发者_Python百科ues. 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!
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
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
精彩评论