DML작업할 테이블과 조건으로 가져올Table이 동일할시에 에러
delete from a_tablewhere a_table.col1 in (select a_table.col1from a_tablewhere a_table.col2 = true) * 이렇게 자기가 DML 을 진행할 table을 조건으로 사용하기위해 select 해서 가져올경우 에러가 발생한다 You can't specify target table 'a_table' for update in FROM clause * 그럴땐 select 를 다시 서브쿼리 처리하면된다(고한다) delete from a_tablewhere a_table.col1 in (select alias_name.col1from (select a_table.col1from a_tablewhere a_table.col2 = true) as a..
DB, Storage/mysql
2014. 7. 9. 15:07