【问题标题】:select from a table where the dates are different to tha dates in other table从日期与其他表中的日期不同的表中选择
【发布时间】:2013-07-27 20:58:07
【问题描述】:

我在一个表中有一些日期,我需要查询表中的日期与第二个表不同,我打算这样做:

http://sqlfiddle.com/#!2/a1308/2

但是现在可以了

我需要例如在第一个表中:

3202024834
3108984111
3118545645
4608389
2631993
9876534
3114568970

在其他方面

3202024834
3108984111
3118545645

那么查询的输出是:

4608389
2631993
9876534
3114568970

【问题讨论】:

    标签: mysql sql database sqlite qsqlquery


    【解决方案1】:

    我将您的问题解释为“在a 中获取不在b 中的值”。如果是这样,解决此问题的一个好方法是使用 left outer joinwhere 子句:

    select a.msisdn
    from msisdn a left outer join
         insertados b
         on a.msisdn = b.numero
    where b.numero is null;
    

    数据是 SQLFiddle 与问题中的数据不完全匹配,因此结果与问题中的数据有点不同。

    【讨论】:

    • 感谢您的帮助。 =)
    猜你喜欢
    • 1970-01-01
    • 2014-01-24
    • 1970-01-01
    • 2016-05-28
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 2014-01-09
    • 2020-03-27
    相关资源
    最近更新 更多