原来的SQL语句
UPDATE product p SET p.price_strategy = 'FREE' WHERE p.id IN ( SELECT p1.id FROM product p1 LEFT JOIN price_info price ON p1.id = price.product_id WHERE p1.tag = 1 AND price.price_strategy = 'FREE' );
执行时,报[Err] 1093 - You can't specify target table 'product' for update in FROM clause
原因:“In general, you cannot modify a table and select from the same table in a subquery.”
如下,加一层嵌套即可
UPDATE product p SET p.price_strategy = 'FREE' WHERE p.id IN ( SELECT temp.id FROM ( SELECT p1.id FROM product p1 LEFT JOIN price_info price ON p1.id = price.product_id WHERE p1.tag = 1 AND price.price_strategy = 'FREE' ) temp );
相关推荐
在MySQL数据库操作中,有时会遇到一个特定的错误:1093 - You can’t specify target table for update in FROM clause。这个错误通常发生在尝试在一个`UPDATE`语句的`FROM`子句中直接引用目标更新表时。MySQL不支持...
在MySQL数据库中,错误代码1093 - "You can’t specify target table ‘t’ for update in FROM clause" 是一个常见的错误,它通常发生在尝试在一个`UPDATE`语句的`FROM`子句中直接引用要更新的目标表时。...
在MySQL数据库中,"You can’t specify target table for update in FROM clause"是一个常见的错误提示,意味着在同一个SQL语句中,你不能直接在一个`UPDATE`或`DELETE`语句的`FROM`子句中引用你想要更新或删除的表...
### MySQL中“You can’t specify target table for update in FROM clause”错误解决方法 在MySQL数据库管理过程中,遇到SQL语法错误是家常便饭,其中一种较为常见的错误是“You can’t specify target table for ...
...
错误消息"You can't specify target table 'wms_cabinet_form' for update in FROM clause"清楚地指出,在同一个UPDATE语句中,你不能先从`wms_cabinet_form`表中选择一些值,然后立即更新这个表。 在原始的UPDATE...
Please specify the final destination directory for installed Postfix configuration files. config_directory: [] bin/postconf: error while loading shared libraries: libmysqlclient.so.16: cannot open ...
### MySQL 5.7在Windows系统上的安装与配置教程 ...此外,还可以参考Specify Software Project网站提供的文档来了解更多关于MySQL安装和配置的信息。 希望本教程能帮助您顺利完成MySQL 5.7的安装与配置工作!
If you use an AT&T 6300 computer, contact AT&T to upgrade your ROM BIOS to version 1.21 or later. The ROM BIOS version number is displayed when you start your computer. 2.14 LANtastic -------------- ...
You can find complete help in 'help.hlp' file ---------------------------------------------------------------------- Radmin ---------------------------------------------------------------------- ...
mysql 语句如下: update wms_cabinet_form set cabf_enabled=0 where cabf_id in ( SELECT wms_cabinet_form.cabf_id FROM wms_cabinet_form Inner Join wms_cabinet ON wms_cabinet_form.cabf_cab_id = wms_...
在平常的项目中,经常会碰到这样的问题:我需要在一张标中同时更新和查询出来的...结果却报错,报错信息为:You can't specify target table 'tb_test' for update in FROM clause,不能在同一语句中update,select同
You can also try asking for help in the Delphi newsgroups. Since the Drag and Drop Component Suite is in widespread use, there's a good chance another user can help you. I recommend the following ...
You can use commands from the Windows Command Prompt or a batch file to control Diskeeper. Group Policy Support -------------------- Diskeeper can be configured network-wide with the Group Policy ...
(b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have...
Update from TC 1.5 - This allows for an easy update from version 1.5. After the files are copied, all the installed options from your current TC.EXE will be transferred to the new one. This is ...
4.In the event that you find a defect of this Product and advise OBJECT of it within one(1) year from the date of purchase, OBJECT will pay for the damage. In no event will OBJECT乫s liability to ...
Update from TC 1.5 - This allows for an easy update from version 1.5. After the files are copied, all the installed options from your current TC.EXE will be transferred to the new one. This is ...