You can't specify target table 'ed_user' for update in FROM clause
时间: 2023-09-14 14:03:17 浏览: 121
mysql中You can’t specify target table for update in FROM clause错误解决方法
It seems that you are encountering an error message related to the SQL query. The error message "You can't specify target table 'ed_user' for update in FROM clause" typically occurs when you try to update a table that is also referenced in the FROM clause of the same query.
To resolve this issue, you can use a subquery to separate the update operation from the select operation. Here's an example of how you can rewrite the query:
```
UPDATE ed_user
SET column_name = new_value
WHERE user_id IN (
SELECT user_id
FROM ed_user
WHERE condition
);
```
In this example, replace `column_name` with the actual column you want to update, `new_value` with the desired new value, `ed_user` with the target table name, and `condition` with the appropriate condition for selecting the rows to update.
By using a subquery, you can avoid referencing the target table in the FROM clause and resolve the error.
阅读全文