insert into systabe(
code,
value,
sort
)
values
( (select AUTO_INCREMENT from information_schema.tables where table_name='systabe'), '微信',1),
( (select AUTO_INCREMENT from information_schema.tables where table_name='systabe'), '支付宝',2),
( (select AUTO_INCREMENT from information_schema.tables where table_name='systabe'), '刷卡',3),
( (select AUTO_INCREMENT from information_schema.tables where table_name='systabe'), '现金',4),
( (select AUTO_INCREMENT from information_schema.tables where table_name='systabe'), '其他',5)
执行后
`第一条就对,后面4条就不对了,不知道为什么,
想实现这样子才是正确的
直接加个主键唯一自增不就好了,干嘛还从systabe去拿呀。
将一条语句插入多条,改为一条语句插入一条。
提高效率可以使用PreparedStatement,批量插入。