mysql 生成max+1编号
#sql info表插入一条数据,number字段根据info表最大number+1插入,若为初始插入,number为100000
#在获取本表number最大值时,mysql不允许直接查询本表获取最大number,会报错You can't specify target table 'r_user_info' for update in FROM clause
INSERT INTO info (id, number) VALUES ( '1d11111', ( SELECT IFNULL(MAX(u.number) + 1,100000) FROM ( SELECT number FROM info ) AS u ) )