Select Count(Table1.B) as Cnt 
from Table1,Table2
Where Table1.A=Table2.A AND ...

解决方案 »

  1.   

    .....from table1 where A in (select table2.A from table2 where .....)
      

  2.   

    你去除重复值试一试Select Count(DISTINCT Table1.B) as Cnt 
    from Table1,Table2
    Where Table1.A in Table2.A AND ...
      

  3.   

    为了避免table1、table2 join的时候出现重复统计,可以使用如下的语法
    Select Count(Table1.B) as Cnt 
      from Table1 x
     Where exists (select 1 from table2 where a=x.a);
      

  4.   

    这个table2的a算是唯一了吧?Select Count(Table1.B) as Cnt 
    from Table1,(select a from table2 group by a) Table2
    Where Table1.A in Table2.A AND ...
      

  5.   

    问题解决了,原来是字段里面的空格引起的问题
    ltrim + rtrim 就ok了