doc_id
이것은 기본 키가
doc_id
인 테이블에서 작동합니다.
select count(*)+1 from doctor where
exp > (select exp from doctor where doc_id='001');
+------------+
| count(*)+1 |
+------------+
| 2 |
+------------+
그러나 테이블의 필드를 설정하기 위해 동일한 select 쿼리를 사용하면 다음 오류가보고됩니다.
update doctor set rank=
( select count(*)+1 from doctor where
exp > (select exp from doctor where doc_id='001')
) where doc_id='001';
ERROR 1093 (HY000): You can't specify target table 'doctor' for update
in FROM clause
내가 말하는 목표 테이블 참조를 이해할 수 없습니다. 누군가 설명 할 수 있습니까?
을 궁금해, 해결 방법이 드러내는 것이나 기술적 인 문제에서 당신을 보호하기위한 제한입니까? – chustar