1:首先新建一个表并插入以下测试数据,如图
2:查询显示行号语句如下
select
@r := @r + 1 as rowNum,
a.*
from aopi as a , (select @r := 0 )as t
order by a.id asc ;
3:显示结果如下图
bye~
mysql 之排序显示行号
1:首先新建一个表并插入以下测试数据,如图
2:查询显示行号语句如下
select
@r := @r + 1 as rowNum,
a.*
from aopi as a , (select @r := 0 )as t
order by a.id asc ;
3:显示结果如下图
bye~