获取不匹配的值连接sql中的两个表
“表1”-->boodang_iphone包含--3000条记录 “table2”->boodang_iphonePushtest05302012表格包含--90条记录 我需要在'boodang_iphonePushtest05302012'比较表1中得到不匹配的值,我这样写查询获取不匹配的值连接sql中的两个表,sql,join,left-join,Sql,Join,Left Join,“表1”-->boodang_iphone包含--3000条记录 “table2”->boodang_iphonePushtest05302012表格包含--90条记录 我需要在'boodang_iphonePushtest05302012'比较表1中得到不匹配的值,我这样写查询 SELECT boodang_iphonePushtest05302012.devicetoken FROM boodang_iphonePushtest05302012 left outer join boodan
SELECT boodang_iphonePushtest05302012.devicetoken
FROM boodang_iphonePushtest05302012
left outer join boodang_iphone on
boodang_iphone.devicetoken=boodang_iphonePushtest05302012.devicetoken
where
boodang_iphonePushtest05302012.devicetoken != boodang_iphone.devicetoken
我很困惑是它提供了正确的数据还是没有任何人可以我们请引导我使用联接获取不匹配值此查询提供存在于
boodang\u iphonePushtest05302012
中但不存在于boodang\u iphone
中的所有记录。但是,您需要通过交换表再次运行查询,因此它将为您提供boodang_iphone
中存在的所有记录,而不是boodang_iphonePushtest05302012
(相反,您可以使用相同的查询,但通过右外连接连接表)。那么你应该得到比较的全部结果
如果可以将where子句更改为
where boodang_iphone.devicetoken IS NULL
那就更好了。这是因为如果值不匹配,那么它将从第二个表返回NULL值,并且如果将NULL值与有效数据进行比较,它总是有问题