赞
踩
select (@rownum := @rownum + 1) AS row_number,a.* from (select * from test_table ) a,(SELECT @rownum := 0) r
select * from test_table为查询的sql,外部套的一层为固定写法
查询结果row_number即为编号,结果示例如下