查询获取排名
2017-08-11 本文已影响0人
linweiyu21
SELECT
*
FROM
(
SELECT t1.*,@rank:=@rank+1 AS RANK
FROM
(SELECT * FROM act_wishcard ORDER BY donationAmount DESC) t1,(SELECT @rank:=0) t2
) t
ORDER BY t.RANK ASC;
SELECT
*
FROM
(
SELECT t1.*,@rank:=@rank+1 AS RANK
FROM
(SELECT * FROM act_wishcard ORDER BY donationAmount DESC) t1,(SELECT @rank:=0) t2
) t
ORDER BY t.RANK ASC;