这适用于doc_id
主键为表的表:
select count(*)+1 from doctor where
exp > (select exp from doctor where doc_id='001');
+------------+
| count(*)+1 |
+------------+
| 2 |
+------------+
但是当我使用相同的选择查询在表中设置字段时,它会报告以下错误:
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
我不明白它在说哪个目标表引用。有人可以解释吗?