You can't specify target table 'tbl_Tags' for update in FROM clause SQL2.sql 30

프로젝트 수행중 인기 태그를 업데이트를 하기 위해 쿼리를 수행하였으나
1 You can't specify target table 'tbl_Tags' for update in FROM clause SQL2.sql 30 1
위에 같은 에러 구문을 만났다.

구글링 결과

위 에러는 update 를 위해서 서브쿼리를 수행할 시에는 서브쿼리의 FROM절과 업데이트 target모두를 위해 같은 테이블을 사용할 수 없다고 한다.

ㅠㅠ

즉, 같은 테이블을 불러와서 같은 테이블에서 업데이트를 못한다고 한다..

방법이 없을까???


 

 

by 다키짱 | 2009/05/14 12:28 | 오라클+mysql+mssql | 트랙백 | 덧글(3)

트랙백 주소 : http://darky.egloos.com/tb/2378550
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
Commented by 묻지마검색 at 2009/08/24 10:03
서브쿼리로 한번 감싸주면 됩니다.


update table set column=1
where column2 IN (select column from table)
이렇게 하면 안됩니다.

하지만
update table set column=1
where column2 IN (select * from (select column from table) as temp)
이렇게 서브쿼리로 한번 감싸주면 됩니다.
Commented by 다키짱 at 2009/08/25 11:40
오호... 감사 감사.. 너무나 좋은 정보입니다......
Commented by Nam at 2009/09/04 14:34
좋은 정보 감사합니다.

:         :

:

비공개 덧글

◀ 이전 페이지          다음 페이지 ▶