使用 insert into +select 的模式
insert into sys_menu (menu_name,menu_url,parent_id,menu_order)
select 'ccc','',0,
(select IFNULL((select max(menu_order)from sys_menu),0))+1
核心在 IFNULL里面的select max也需要加上括号,防止,空表插入的时候报错问题
使用 insert into +select 的模式
insert into sys_menu (menu_name,menu_url,parent_id,menu_order)
select 'ccc','',0,
(select IFNULL((select max(menu_order)from sys_menu),0))+1
核心在 IFNULL里面的select max也需要加上括号,防止,空表插入的时候报错问题
转载于:https://my.oschina.net/u/3500033/blog/1816933