请问TEST_CJ5_2表中的P_ID跟ONLY_ONE_CLASS表中的
P_ID多了或少了的值,是记录数多了、少了的意思,
还是别的意思?

解决方案 »

  1.   


    It’s too easy.用not exists和not in都可以判断.
    /***************************************************/
    铁的承诺,风的回忆.
    永远的亚特兰蒂斯,永远的炎龙骑士团.
    /***************************************************/
      

  2.   

    用外连接select a.*, b.*
       from only_one_class  a
            full outer join
            test_cj5_2 b
            on a.P_ID=b.P_ID
       where a.P_ID is null or b.P_ID is null如果是Oracle, Oracle的那个外连接是什么运算符来着? 呵呵
      

  3.   

    only_one_class比test_cj5_2多的p_id:
    select p_id from only_one_class
    where not exists (select * from test_cj5_2 where test_cj5_2.p_id=only_one_class.p_id)test_cj5_2比only_one_class多的p_id:
    select p_id from test_cj5_2
    where not exists (select * from only_one_class where test_cj5_2.p_id=only_one_class.p_id)