解决方案 »

  1.   

    语句看着没什么问题
    可以先查一下 a b 两个表中是否有ID或时间为空的数据
    这类数据可能会造成查询的范围扩大
      

  2.   

    时间这个字段是有的为空,有的不为空的, 但我用一个id作为条件去限制查询的时候, 本来a, b 表对比只应该查出一条数据, 但运行之后查出三条来, 而且, 时间都不空..  我不知道它究竟是怎么运行来对比的. 为什么会出现这种状况?
      

  3.   

    select * from a a where exists (select 1 from b b where a.id=b.id and a.sj<>b.sj)
    and not exists (select 1 from b b where a.id=b.id and a.sj=b.sj)
    这样?
      

  4.   

    oracle的时间是带小时分秒的,改为trunc(a.sj) <> trunc(b.sj)只比较日期试下