SELECT id,name,num,
(SELECT count(DISTINCT 字段) FROM 表名 AS b WHERE a.字段<b.字段)+1 AS rank
FROM 表名 AS a
TP5模型
$field = "*,(SELECT count(DISTINCT num) FROM charitable_player AS b WHERE a.num<b.num)+1 AS rank";
$lists = $this->model->alias('a')->field($field)-select();
本文为Pasa吴原创文章,转载无需和我联系,但请注明来自Pasa吴博客https://www.pasawu.top
最新评论