MySQl 遇到一个比较特殊问题,SQL语句如下:
DELETE FROM table1 WHERE id in (select t1.id from table2 as t2,table1 as t1 where t2.id=t1.refer_id and t2.code like 'test%');
运行时提出如下提示: You can't specify target table 'table1' for update in FROM clause。
运行 in 里面的 select 字句:正常执行。
原因是:子查询select的字段 和 delete 表都是同一个表,MySQL不允许这样,不能先select出同一表中的某些值,再delete/update这个表(在同一语句中)。
解决方法:使用临时表
DELETE FROM table1 WHERE id in (select t1.id from table2 as t2,(select * from table1)t1 where t2.id=t1.refer_id and t2.code like 'test%');
相关推荐
mysql 一个较特殊的问题:You can't specify target table 'wms_cabinet_form' for update in F
最近在工作中遇到了一个mysql错误提示1093:You can’t specify target table for update in FROM clause,后来通过查找相关的资料解决了这个问题,现在将解决的方法分享给大家,有需要的朋友们可以参考借鉴,下面来...
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_...
主要介绍了mysql中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修改...
。。。
...
在平常的项目中,经常会碰到这样的问题:我需要在一张标中同时更新和查询出来的...结果却报错,报错信息为:You can't specify target table 'tb_test' for update in FROM clause,不能在同一语句中update,select同
_____ "] "HR Mgr: " " " "] "Purchasing " "_______________________" " " "[ "Mgr:__________________" "_ " " " "] "__ " "ADM " " " " "PMC " "Mgr:___________________" " " " "Sup:__________________" "_____...
Protel DXP 提供了一些高级的编辑技巧用于满足设计的需要,主要包括放置文字、放置焊盘、放置过孔和放置填充等组件放置,以及包地、补泪滴、敷铜等 PCB 编辑技巧。生成Gerber文件和钻孔文件的一般步骤 。
主要介绍了linux mount报错:you must specify the filesystem type的解决方法,文中给出了详细的解决方法示例,对大家具有一定的参考价值,需要的朋友们下面来一起看看吧。
本算法的linux版
pre-UAL syntax does not specify the "s" (flag update) in the opcodes for arithmetic operations involving the low set of registers (r0-r7). For example: pre-UAL Syntax | UAL Syntax ;Note -----------...
Couldn't connect to server from the Internet. Perhaps direct connections are not allowed in the current network. To use proxy please check/specify these environment variables: - ...
用Verilog语言的specify语句编写实现路径延迟模块的程序
(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...
- NEW: You can now drag & drop GUI prefabs from your Project Folder right into the Scene View. No need to create the UI beforehand. - NEW: You can now copy/paste label styles by right-clicking the ...