MYsql 排名

SELECT @counter:=@counter+1 AS rank,t.* FROM ( SELECT a.id,b.player_name,a.snatch_times FROM player_attribute a,player b WHERE a.id = b.id AND IFNULL(a.snatch_times,0)>0 ORDER BY a.snatch_times DESC) t,(SELECT @counter :=0) r; 

你可能感兴趣的:(MYsql 排名)