当前位置:Gxlcms > mysql > MySQL实现简单row_number()的模拟

MySQL实现简单row_number()的模拟

时间:2021-07-01 10:21:17 帮助过:4人阅读

无详细内容 无 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

人气教程排行