티스토리 뷰

### AS-IS

DELETE
FROM cwd_group
WHERE id IN
    (SELECT DISTINCT a.id ext_id
     FROM cwd_group a
     JOIN cwd_group b ON a.group_name=b.group_name
     JOIN cwd_directory d ON d.id=a.directory_id
     WHERE a.directory_id != b.directory_id
       AND directory_name = 'My JIRA Server');

### TO-BE

DELETE
FROM cwd_group
WHERE id IN
    (SELECT ext_id
     FROM
       (SELECT DISTINCT a.id ext_id
        FROM cwd_group a
        JOIN cwd_group b ON a.group_name=b.group_name
        JOIN cwd_directory d ON d.id=a.directory_id
        WHERE a.directory_id != b.directory_id
          AND directory_name = 'My JIRA Server') tmp) ;

https://www.lesstif.com/dbms/mysql-error-1093-you-can-t-specify-target-table-tablename-for-update-in-from-clause-18220088.html

 

MySQL Error 1093 : You can't specify target table 'tablename' for update in FROM clause

 

www.lesstif.com

 

댓글
댓글쓰기 폼