select c.cus_name,tsdz_sum=isnull(count(*),0) from a_rel a inner join b_rel b on a.entry_id=b.entry_id  where date1 between date2 and date3 group by C.cus_name 

解决方案 »

  1.   

    没有 c
    改为以下语句试试:
    select b.cus_name,tsdz_sum=isnull(count(*),0) from a_rel a inner join b_rel b on a.entry_id=b.entry_id  where date1 between date2 and date3 group by b.cus_name 
      

  2.   

    this can't !i write wrong ,should b.cus_name!
    but still not affect
      

  3.   

    试着区分一下左右连接,好像效果是不一样的,但我不知道对Count()是否有用。
      

  4.   

    你用的内连接和count(*),那样count(*)计算你内连接后的记录数!你看看是不是你要的结果!