时间:2021-07-01 10:21:17 帮助过:23人阅读
在网上找了再三,通过比较,确认了以下的方法是可行的 :
SELECT @rownum:=@rownum+1 rownum, CollectSn From (SELECT @rownum:=0,bbgmain.* FROM qbdb.bbgmain WHERE collectsn!=‘‘ ORDER BY collectsn limit 10) t
按照点击数排序,查询new表里的文章排名
select * from ( select @rank:=@rank+1 as rank, id, title from (select @rank:=0, news.* from news order by dian_num desc) rank) news_rank where id = 4;
MySQL 的 RowNum 实现
标签: