집 >데이터 베이스 >MySQL 튜토리얼 >MySQL实现简单row_number()的模拟
无详细内容 无 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