MySQL实现简单row_number()的模拟
程序员文章站
2022-04-19 09:42:58
...
无详细内容 无 set @name='';set @num=0;select r.name, r.score, @num:=if(@name=r.name,@num+1,1) rn0, @name:=r.name namesfrom new_table_test rorder by 1,2 asc
set @name=''; set @num=0; select r.name, r.score, @num:=if(@name=r.name,@num+1,1) rn0, @name:=r.name names from new_table_test r order by 1,2 asc