MySql implements rownum column similar to Oracle

Mysql implements paging using the limit starting position and the number of entries per page, but there is no ranking rownum through a three-tier query like oracle, so we have to implement similar functions ourselves

select @rownum:=@rownum+1,tmp.email,tmp.nickName,tmp.score from (
select @rownum:=0,t.email,t.nickName,t.score from table t order by score desc 

) tmp


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324840010&siteId=291194637