Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

sort players by sum of results

      
            
                
            
 run  | edit  | history  | help 0

create table resulttbl (PlayerId int, result int);

  by  viswanadh_sql, 2 years ago


INSERT INTO resulttbl (Playerid,result) values (1,100),(1, 80),(1, 80),(2,100),(2, 80),(2, 40),(2, 40),(3,160),(3,100),(4,130),(4,130),(5,270);

  by  viswanadh_sql, 2 years ago


select PlayerId, sum(result) res, group_concat(result) rlist from resulttbl GROUP BY PlayerId ORDER BY sum(result) desc, count(*)

  by  viswanadh_sql, 2 years ago




Please log in to post a comment.
cus
itm