发布网友 发布时间:2022-04-22 10:26
共3个回答
热心网友 时间:2022-04-06 08:31
SELECT
obj.user_id,obj.score,@rownum := @rownum + 1 AS rownum
FROM
(
SELECT
user_id,
score
FROM
`sql_rank`
ORDER BY
score DESC
) AS obj,
(SELECT @rownum := 0) r
执行的结果如下图:
热心网友 时间:2022-04-06 09:49
select (select count(*) from `table` where k.socre<=score or (k.score=score and k.time<time)) as paiming
from `table` k
where userid=293273;
热心网友 时间:2022-04-06 11:24
2楼高人,思想很灵活