MySQL排⾏榜名次并列情况查询,⽀持分页
SELECT
t.*, @rownum := @rownum + 1 AS temp
FROM
小人国纪录片(
SELECT
obj.*,
@rownum := @rownum + 1 AS num_tmp,
@incrnum as incrnum,
@incrnum := CASE
WHEN @rowtotal = obj.score THEN
@incrnum
WHEN @rowtotal := obj.score THEN
平方差公式和完全平方公式@rownum
WHEN @rowtotal =0 THEN @rownum
END AS bank
FROM
(
SELECT
uid,`name`,score,works_no,works_title
FROM
`works` where aid=1
生活中的一朵浪花
革命ORDER BY
score DESC
) AS obj,
(
行车记录仪怎么用SELECT
阳宅风水怎么看@rownum := 0 ,@rowtotal := NULL ,@incrnum := 0
) r
) AS t limit 1,2
score 是表⽰ 表⽰作品得分:
查出来后是
score bank
斐讯k2
62 1
56 2
56 2
45 4野日
43 5