mysql中You can't specify target table for update in FROM clause错误

原SQL

delete from DEP_SYSTEM_PORTLET_SETTINGS where ID in (
        select ID from
        DEP_SYSTEM_PORTLET_SETTINGS 
        group by (USER_ID) HAVING count(USER_ID) >1
)

修改后

delete from DEP_SYSTEM_PORTLET_SETTINGS where ID in (
        select ID from (
        select ID from
        DEP_SYSTEM_PORTLET_SETTINGS 
        group by (USER_ID) HAVING count(USER_ID) >1
        ) C
)

 

posted @ 2015-10-26 17:12  旋转的梦  阅读(175)  评论(0编辑  收藏  举报