select count(socre) from a order by id desc group by score

解决方案 »

  1.   

    group by 中不包含id会提示语法错误
      

  2.   

    select id, score, (select count(*) from 表A where score = B.score) as 数量
     from 表A as B where id = (select min(id) from 表A where score = B.score)
     order by id desc
      

  3.   

    1、score值相同的记录只列出一次
    SELECT DISTINCT(SCORE) FROM A 2、统计score值相同的数量
    3、查询结果按id降序排列。
    SELECT SUM(SCORE) 
    FROM A 
    WHERE SCORE IN(SELECT SCORE FROM A GROUP BY SCORE HAVING COUNT(SCORE)>1)
    ORDER BY id DESC
      

  4.   

    select id,name, (select top 1   distinct  score from table t where table.id=t.id) as score,(select count(score) from table t where table.score=t.score group by score) as数量 
    from table
    order by id desc
      

  5.   

    select max(id) as id,score,count(*) as 数量 from table group by score order by id desc