select a.B,count(*) from (select B from tb where ........)as a group by B;

解决方案 »

  1.   

    a.B表示查询结果(select B from tb where ........)里面的B字段
      

  2.   

    trampwind(随风) ,你好,语句:
    select a.B,count(*) from (select B from tb where ........)as a group by B;你在mysql中测试过了吗?我试报如下错:
    ERROR 1064: You have an error in your SQL syntax还有别的办法吗??谢谢了
      

  3.   

    php 4.0 没有SQL语句嵌套的用法,所以会错的。
      

  4.   

    mysql没测过,低版本的mysql好象不支持子查询之类的
      

  5.   

    select B,count(B) from tb where C=*** and D=*** and E=**  group by B;