解决方案 »

  1.   

    select sum(if(performance =1,1,0)) as p1,
    sum(if(performance =2,1,0)) as p2,
    ...
    sum(if(performance =5,1,0)) as p5
     from comment where status=1 and jid=1
      

  2.   

    select max(pCnt),t.performance 
    from
    (select count(performance) as pCnt ,performance from comment where jid=1) t
      

  3.   

    忘了加上这个group by performanceselect max(pCnt),t.performance 
    from
    (select count(performance) as pCnt ,performance from comment where jid=1 group by performance) t
      

  4.   

    select max(pCnt),t.performance 
    from
    (select count(performance) as pCnt ,performance from comment where jid=1 group by performance) t
    这个是求某个分数的个数最多的select max(pSum),t.performance 
    from
    (select sum(performance) as pSum ,performance from comment where jid=1 group by performance) t
    这个是求某个分数总计起来最大的
      

  5.   

    select cid,performance,count(performance) 
    from
    comment 
    where jid=4022 and status=1 
    GROUP BY performance 
    order by COUNT(performance) desc这样可以解决了,还是谢谢你们
      

  6.   

    这样
    select  t2.performance from
    (select max(pSum),t.performance from
    (select sum(performance) as pSum ,performance from comment where jid=1 group by performance) t ) t2