解决mysql不能修改(You can't specify target table 'basic_data' for update in FROM clause)
2013-03-02 15:09
573 查看
今天遇到一个问题
You can't specify target table 'basic_data' for update in FROM clause
原句
修改后
原理 是mysql 把 查询子句当做一个临时表,不在当做一个实体表
You can't specify target table 'basic_data' for update in FROM clause
原句
UPDATE basic_data SET manage_user=4 WHERE id IN (SELECT b.id from basic_data b JOIN department d on d.id =b.department JOIN users u on u.department_id=d.id where d.id=1)
修改后
UPDATE basic_data SET manage_user=4 WHERE id IN (SELECT b.id from (SELECT * FROM basic_data) b JOIN department d on d.id =b.department JOIN users u on u.department_id=d.id where d.id=1)
原理 是mysql 把 查询子句当做一个临时表,不在当做一个实体表
相关文章推荐
- MySQL "You can't specify target table 'X' for update in FROM clause" 错误解决方法
- MySQL报错“ you can't specify the target table for ‘update’ in from clause”
- MySQL之You can't specify target table for update in FROM clause解决办法
- MYSQL之You can't specify target table for update in FROM clause解决办法
- [Django](1093, "You can't specify target table 'fee_details_invoices' for update in FROM clause") 错误
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- MySQL 中 You can't specify target table '表名' for update in FROM clause错误解决办法
- MYSQL:You can’t specify target table for update in FROM clause 解决办法
- mysql 出现You can't specify target table for update in FROM clause错误的解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- MYSQL:You can’t specify target table for update in FROM clause 解决办法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- MYSQL之You can't specify target table for update in FROM clause解决办法
- mysql错误:1093-You can’t specify target table for update in FROM clause的解决方法
- mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法
- mysql You can't specify target table for update in FROM clause解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- 移动文章分类的sql语句,查询并更新同一个表的方法 You can't specify target table 'news_articles' for update in FROM clause