我有桌子Creditcard,,Childcreditcard1Childcreditcard2
儿童信用卡1
CreditcardID TranscationDatetime
22222132132 2010-04-11 12:36:10.210
22222132134 2011-04-11 12:36:10.210
12364132122 2019-04-11 12:36:10.210
45677132124 2011-04-11 12:36:10.210
45677132124 2012-04-11 12:36:10.210
儿童信用卡2
CreditcardID TranscationDatetime
22222132132 2010-04-11 12:36:10.210
22222732134 2011-04-11 12:36:10.210
12364132192 2019-04-11 12:36:10.210
万事达信用卡
CreditcardID primaryCreditID
22222132132 22222132132
22222132134 22222132132
12364132122 12364132122
45677132124 45677132124
45677232124 45677232124
78567723212 78567723212
23677232124 23677232124
45678944343 45678944343
22222732134 22222732134
12364132192 12364132192
现在从这三个表中,我需要仅从我们拥有的任何内容中获取creditcardID不匹配的表,表将始终存在于表中MasterCreditcardCreditcardIDChildcreditcard1Childcreditcard2MasterCreditcard
结果应该是表格应该是这样的
45677232124
78567723212
23677232124
45678944343
我的查询:
select
distinct(cc.CreditcardID)
from
MasterCreditcard CC
inner JOIN
Childcreditcard1 c1 ON CC.CreditcardID <> c1.CreditcardID
inner JOIN
Childcreditcard2 c2 ON CC.CreditcardID <> c2.CreditcardID
我试过这样,但这给出CreditcardID了MasterCreditcard表中所有错误的结果
