[转]MySQL 行号

来源:互联网 发布:apache安装配置 编辑:程序博客网 时间:2024/05/16 16:03

本文转自:http://xi5566.javaeye.com/blog/204753

select *,(select count(*)+1 from table where table.userId<a.userId )as rowId from table as a
注意这里的userId一定要是自增长