select a.*,(select count(*)+1 from table t where t.customer_id<a.customer_id )
as rowdId from table2 order by rowdId asc
分析如下:
1.在mysql中没有统计行号的函数呀;所以现在只能通过一个内嵌的sql语句来实现;
2、内嵌sql是根据统计数加1之后;然后控制内层ID《外层ID这样才可以,统计出每一行所对应该的行数呀;
Mysql表的行号
最新推荐文章于 2024-07-29 11:25:31 发布