... where exists (select ... from ... where ).

解决方案 »

  1.   

    select * from tmp2 where tmp2.dt1 not in (select tmp1.dt from tmp1,tmp2 where tmp1.c1=tmp2.c1 and  tmp1.c2=tmp2.c2 and tmp1.c3=tmp2.c3);能给出完整的exists等价代码吗?谢谢
      

  2.   

    select tmp1.dt from tmp1 where tmp1.dt in (Select tmp1.dt,tmp2.dt1 from tmp1,tmp2 where tmp1.c1=tmp2.c1 and tmp1.c2=tmp2.c2 amd tmp1.c3=tmp2.c3)
    select tmp1.dt 
    from tmp1 a
    where exists 
     (Select * from tmp2 b 
       where a.c1=b.c1 and a.c2=b.c2 amd a.c3=b.c3)
      

  3.   

    select tmp1.dt from tmp1 where EXISTS (Select 1 from tmp1,tmp2 where tmp1.c1=tmp2.c1 and tmp1.c2=tmp2.c2 amd tmp1.c3=tmp2.c3)
      

  4.   

    select tmp1.dt from tmp1 where EXISTS (Select 1 from tmp1,tmp2 where tmp1.c1=tmp2.c1 and tmp1.c2=tmp2.c2 amd tmp1.c3=tmp2.c3)
      

  5.   

    这样直接把tmp1.dt in 改成 exists好象不对,我试过了,本来有三条记录,现在没有记录。我想:应该做点变化,就是不知道如何变,能再帮帮我吗?谢谢
      

  6.   

    这样直接把tmp1.dt in 改成 exists好象不对,我试过了,本来有三条记录,现在没有记录。我想:应该做点变化,就是不知道如何变,能再帮帮我吗?谢谢
      

  7.   

    IN语句有错吧,用IN 的时候在()中只能SELECT 一列,多列的话ORACLE怎么判定是对照哪个来执行IN呢?试着写一下:
    select a.dt from tmp1 a  
    where exists
       (select * from tmp1 b,tmp2 c
        where b.c1=c.c1 and b.c2=c.c2 and b.c3=c.c3 
        and a.dt = b.dt)
      

  8.   

    试试这个:
    select a.dt 
    from tmp1 a  
    where exists
    (select * 
     from tmp2 b
     where a.c1=b.c1 and a.c2=b.c2 and a.c3=b.c3)