#以下是每次执行都初始化变量伪自增序列从0开始,不是从1开始自增SELECT @rownum:=0#以chinapostlocalregistry表增加流水号为例。#insert into chinapostlocalregistry(number,Type,IsUsed,Created,UsedDate)select CONCAT('LAODD',DATE_FORMAT(now(),'%Y%m%d'),LPAD(@rownum:=@rownum+1,4,'0')),21,0,now(),NULL from chinapostlocalregistry