explain select t.n from
(
select @n:=(coalesce(@n,0))+1 as n ,id from (select @n:=0 ) t ,student
where id = 342 order by created_at score
) t where t.id = 301 ;
查询学生301 在学生按分数排行中所在的排位
explain select t.n from
(
select @n:=(coalesce(@n,0))+1 as n ,id from (select @n:=0 ) t ,student
where id = 342 order by created_at score
) t where t.id = 301 ;
查询学生301 在学生按分数排行中所在的排位