sql4:table1中有,table2中没有的 子段1 的个数。
sql5:table1中有,并且不存在于(table2中存在,并且在table1.h323id里面也存在的)里面这24条数据是
Select count(子段1)From table1 Where 子段1 Not In(Select 子段1 From table2 Where 子段1 not In (select h323id From table1));

解决方案 »

  1.   

    据你写的SQL语句,应该是你表中的数据不一样才得这个结果的,与sql4,sql5无关,当然sql5肯定扩展了一些语句了
      

  2.   

    不好意思,sql5写错了,应该为
    5.Select count(子段1)From table1 Where 子段1 Not In(Select 子段1 From table2 Where 子段1 In (select 子段1 From table1));结果为24
      

  3.   

    3.Select count(子段1)From table2 Where  子段1 In (select h323id From table1);结果为660
    这一个也写错了吧。同样。
      

  4.   

    4:table1中有,table2中没有的记录数。
    5;从table1中过滤出包含table2的记录,就是显示table1中在table2中没有的记录
      

  5.   

    4 table1.field1 都在 table2.field1中,故结果为0。
    5 table2.field1 在table1.h323id中有N个,而table1.field1不在这N个中的有24个。
      

  6.   

    4 table1.field1 都在 table2.field1 中,故结果为0。
    5 table2.field1 在table1.field1 中有N个,而 table1.field1 不在这N个中的有24个。
      

  7.   

    这么多错误,重写一遍
    表table1和表table2中的子段1格式相同
    1.Select count(子段1)From table1;结果为684
    2.Select count(子段1)From table2;结果为13763.Select count(子段1)From table2 Where  子段1 In (select 子段1 From table1);结果为660
    4.Select count(子段1)From table1 Where 子段1 Not In(Select 子段1 From table2);结果为0
    5.Select count(子段1)From table1 Where 子段1 Not In(Select 子段1 From table2 Where 子段1 In (select 子段1 From table1));结果为24
    请问sql4和sql5的结果为什么不一样?
      

  8.   

    table1:684条
    table2:1376条
    在table2中,并且也存在于table1中的:660 
    (存在于table2,不在table1的为 1376-660=716条)在table1中,但不在table2中的:0条 (说明table1是table2的真子集)你的第五个语句肯定不是这样写的吧?
      

  9.   

    TO 楼主
    你把第5句的COUNT(*)换成* 看看结果是什么,其中的field1都有哪些,也许是一些奇怪的东东。
      

  10.   

    我猜如果确有24个,那24个field1应该是NULL吧。