This works in the table, where doc_idis the primary key:
select count(*)+1 from doctor where
exp > (select exp from doctor where doc_id='001');
+------------+
| count(*)+1 |
+------------+
| 2 |
+------------+
But when I use the same select query to set the field in the table, it reports the following error:
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
I can’t understand what target link table she is talking about. Can someone explain?
user191776
source
share