赞
踩
首先,看看@rowNo的用法:
select @rowNo := @rowNo as rank FROM (select @rowNo :=1) q
在看具体引用,如何排名:
SELECT * FROM (select @rowNo := @rowNo + 1 as rank, ppr.uid from poem_program_read ppr LEFT JOIN poem_user pus ON pus.id = ppr.uid,
(select @rowNo :=0) q WHERE ppr.pid = #{pid}
order by ppr.likeCount DESC,ppr.create_time) t
WHERE t.uid = #{uid}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。