select count(*),a.aa from abcd a where a.bb=bb group by a.aa
如何用 group by 显示 count(*)=0的那些行。

解决方案 »

  1.   


    select count(*),a.aa from abcd a where a.bb=bb group by a.aa
    having count(*)=0
      

  2.   

    从这个语句来说,既然都group by a.aa 了,所以不可能存在count(*)=0的行。
      

  3.   

    唯一可能是 a.bb<>bb 的情况
    所以顶多也就是
    select * from abcd a where isnull(a.bb,'')<>bb  -- isnull 防止字段出现null情况