Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在表中有一些日期,我需要查询表中的日期与第二个表不同,我打算这样做:
http://sqlfiddle.com/#!2/a1308/2
但它现在有效
例如,我需要在第一个表中:
3202024834 3108984111 3118545645 4608389 2631993 9876534 3114568970
而在其他
3202024834 3108984111 3118545645
那么查询的输出是:
4608389 2631993 9876534 3114568970
我将您的问题解释为“获取a不在其中的值b”。如果是这样,解决此问题的一个好方法是使用left outer joinwithwhere子句:
a
b
left outer join
where
select a.msisdn from msisdn a left outer join insertados b on a.msisdn = b.numero where b.numero is null;
数据是 SQLFiddle 与问题中的数据不完全匹配,因此结果与问题中的数据略有不同。