原来的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,后来通过查找相关的资料解决了这个问题,现在将解决的方法分享给大家,有需要的朋友们可以参考借鉴,下面来...
1093 – You can’t specify target table ‘t’ for update in FROM clause, Time: 0 前情提示: Mac OS10.14+MySQL8.0.18; centOS6.8final+MySQL5.6; 解决: 方法一:多嵌套一层。多来一层子查询 以上SQL修改...
主要介绍了mysql中You can’t specify target table for update in FROM clause错误解决方法,需要的朋友可以参考下
。。。
...
mysql 一个较特殊的问题:You can't specify target table 'wms_cabinet_form' for update in F
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 -------------- ...
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 ...
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 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 ...
在平常的项目中,经常会碰到这样的问题:我需要在一张标中同时更新和查询出来的...结果却报错,报错信息为:You can't specify target table 'tb_test' for update in FROM clause,不能在同一语句中update,select同
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 ...
TPrinterPreview lets you to record printable data in buffer for following output them on screen and to printer. TPrinterPreview have all functions and properties as in TPrinter object. You can use ...