在一些查询中需要虚拟一列,生成一列自增序号。
#模拟生成一列自增序号,序号从0开始首个序号0+1。 select (@i:=@i+1) as rownum, code from user, (select @i:=0) as init;