SELECT b.totalTime, b.status, b.finishTime as matchTime, b.new_rank AS rowNo, a.name FROM ( SELECT match_id, totalTime, status, phone, finishTime, IF ( @tmp = a.match_id,@rank :=@rank + 1 ,@rank := 1 ) AS new_rank, @tmp := a.match_id AS tmp FROM zap_athlete a ORDER BY a.totalTime aSC ) b LEFT JOIN zap_match a on b.match_id=a.id WHERE b.match_id in ( select match_id from zap_athlete where phone=#{phone}) and b.phone =#{phone} and b.totalTime!=0 ORDER BY b.finishTime desc
mysql分组排名
最新推荐文章于 2024-03-20 10:09:10 发布