0
这里有2个表:如何选择没有适当的键的行?
declare @Table1 table (ID int NOT NULL PRIMARY KEY, Value int)
declare @Table2 table (ID int NOT NULL PRIMARY KEY, Value int)
insert into @Table1 (ID, Value)
select 1, 100
union all
select 2, 101
union all
select 3, 103
union all
select 4, 104
union all
select 5, 105
insert into @Table2 (ID, Value)
select 1, 100
union all
select 2, 110
union all
select 3, 111
我需要从第一个表中的所有行,它的价值的价值观是不是在表2。怎么做?
如果在什么第二个表某些值为NULL? – tesicg
这不是新问题,因为如果Value的值为NULL,则上部查询不起作用。 – tesicg
本文可能有所帮助:[链接](http://stackoverflow.com/questions/2686254/how-to-select-all-records-from-one-table-that-do-not-exist-in-another-表) – Nemeas