1

this worked once before for me but the script is not working now i want toinsert into another table but without any dupes......

 select * from [Data_Guru].[dbo].[MORTGAGE_AUG_27_new_1] 
 where Phone not in (select Phone from [dbo].MASTER_LIST)

that is the bottom part that i am having trouble with when i change it to another table it shows all of the numbers that are not in that table. and i do know for a fact that there shouldnt be many if any duplicate records in the 2 tables.. they are complete different categories....pleas help

4

2 回答 2

0

通常,“in”和“not in”查询的问题是 NULL 的存在。尝试这个:

select *
from [Data_Guru].[dbo].[MORTGAGE_AUG_27_new_1]
where Phone not in (select Phone from [dbo].MASTER_LIST where Phone is not null) 
于 2012-08-27T21:38:11.403 回答
0
select distinct * from [Data_Guru].[dbo].[MORTGAGE_AUG_27_new_1] t1
where NOT EXISTS (select Phone from [dbo].MASTER_LIST where t1.phone=t2.phone)
于 2012-08-28T04:35:07.160 回答