mysql You can't specify target table 'sys_right_menu' for update in FROM clause (不能从Objor子句中指定目标表“SysRyType菜单)

错误语句:

DELETE from sys_right_menu where right_id  in (
SELECT m.right_id from sys_right_menu  m
LEFT JOIN sys_right  r on r.right_id=m.right_id
WHERE r.right_id is null
)

更正后:

DELETE from sys_right_menu where right_id  in (
SELECT right_id from (
SELECT m.right_id from sys_right_menu  m
LEFT JOIN sys_right  r on r.right_id=m.right_id
WHERE r.right_id is null
) a
)

posted @ 2018-07-20 12:29  小奉手  阅读(397)  评论(0编辑  收藏  举报