select name,result,count(*) over(partition by name) num from table order by num,name

解决方案 »

  1.   

    select b.*
    (select name,count(*) times from table1 where result ='奖'
    group by name
    order by times) a ,table1 b
    where a.name = b.name
    order by a.times
      

  2.   

    select name,count(result) num from table group by name order by num
      

  3.   

    select name,result,icount 
    from(select name,result,count(result) as icount from test group by name,result) 
    order by icount desc
      

  4.   

    上面语句可以简写成:
    select name,result,count(result) as icount from test group by name,result  
    order by icount desc