MySQLでOracleのrownumのような行番号を付加する方法
MySQLコード:
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
Coding Changes the World
MySQLコード:
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