MySQL:You can’t specify target table ‘A’ for update in FROM clause
按照MYSQL5.0文件的解釋:我們不能在修改表A的同時在其子查詢中使用到表A,但是可以通過在子查詢中在巢狀一層針對表A的子查詢,因為最裡層的子查詢產生的結果存在臨時表中,與表A沒有關係。
解決方法:把類似於 UPDATE t ... WHERE col = (SELECT ... FROM t ...); 改寫成UPDATE t ... WHERE col = (SELECT (SELECT ... FROM t...) AS _t ...);即可。
文件原文:In general, you cannot modify a table and select from the same table in a subquery. For example, this limitation applies to statements of the following forms:
例如 UPDATE student SET student.name = 'aa' WHERE id=(SELECT __tmpTable.id FROM (SELECT...FROM t) as _tmpTable )
相關推薦
MySQL:You can’t specify target table ‘A’ for update in FROM clause
按照MYSQL5.0文件的解釋:我們不能在修改表A的同時在其子查詢中使用到表A,但是可以通過在子查詢中在巢狀一層針對表A的子查詢,因為最裡層的子查詢產生的結果存在臨時表中,與表A沒有關係。 解決方法:把類似於 UPDATE t ... WHERE col = (SELE
MySQL 錯誤碼: 1093 You can't specify target table 'jc_user' for update in FROM clause
MySQL 錯誤碼: 1093 You can’t specify target table ‘jc_user’ for update in FROM clause bug如何出現及解決方案 根據錯誤資訊可知:不能查詢一張表的同時修改同一張表
MySQL 中 You can't specify target table '表名' for update in FROM clause錯誤
在MySQL中,寫SQL語句的時候 ,可能會遇到You can't specify target table '表名' for update in FROM clause這樣的錯誤,它的意思是說,不能先select出同一表中的某些值,再更新這個表(在同一語句中),即不能依據某
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
MySQL 中 You can't specify target table '表名' for update in FROM clause錯誤解決辦法
在MySQL中,寫SQL語句的時候 ,可能會遇到You can't specify target table '表名' for update in FROM clause這樣的錯誤,它的意思是說,不能先select出同一表中的某些值,再update這個表(在同一語句中),即
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語句中,先select同一個表的某些值,然後再update這個表。 例如:message表儲存了多個使用者的訊息 建立表 CREATE TABLE
You can't specify target table 'table' for update in FROM clause
tar bsp stock select CA HA lec pan having delete from table1 where ID not in(select max(ID) ID from table1 group by row1) and row1 in
如何解決You can’t specify target table for update in FROM clause錯誤
mysql中You can’t specify target table for update in FROM clause錯誤的意思是說,不能先select出同一表中的某些值,再update這個表(在同一語句中)。 例如下面這個sql:delete from target_info_day where id
按條件刪除記錄時報You can’t specify target table for update in FROM clause錯誤解決方法(寫於20161107)
核心概念: mysql中,不能先select一個表的記錄,在按此條件進行更新和刪除同一個表的記錄。解決辦法是,將select得到的結果,再通過中間表select一遍,這樣就規避了錯誤,這個問題只出現於mysql,mssql和oracle不會出現此問題。自己例項一:如下業務場景,ecs_order_sh
關於mysql 5.7版本“報[Err] 1093 - You can't specify target table 'XXX' for update in FROM clause”錯誤的bug
title _id fma xxx tps ice sql each targe 不同於oracle和sqlserver,mysql並不支持在更新某個表的數據時又查詢了它,而查詢的數據又做了更新的條件,因此我們需要使用如下的語句繞過: UPDATE teaching_de
MySQL:You can't specify target table for update in FROM clause
問題:You can't specify target table for update in FROM clause 含義:不能在同一表中查詢的資料作為同一表的更新資料。 注意:這個問題只出現於mysql,mssql和oracle不會出現此問題。 delete from people wher
mysql修改刪除You can't specify target table for update in FROM clause的問題
you div code sql 語句 操作 查詢 重復數 -c sele 表中出現重復數據,需要刪除重復數據,只保留一條 DELETE FROM crm_participant WHERE id IN ( SELECT c.id cid F
You can't specify target table 't_mail_marketing' for update in FROM clause
update in table use pre RKE can stat mail date update t_mail_marketing set `STATUS` = 1 where ID in ( select b.PARENT_ID from (SELECT D
[Err] 1093 - You can't specify target table 'master_data' for update in FROM clause
sel master mce 沒有 AR delete 查詢 數據 select delete from master_data where category_id not in (select category_id from master_data a, bc_cate
You can't specify target table 't_open_user' for update in FROM clause
https://blog.csdn.net/jiangyu1013/article/details/79108498 報錯如題,意思大致是:在一條 sql 語句中不能先查出來部分內容,再同時又對當前表作修改。 解決方法:給查詢加別名,用中間表來實現不是對同一表作操作。 如錯誤定法
錯誤:You can't specify target table 'xxx' for update in FROM clause的解決
參考:https://www.cnblogs.com/pcheng/p/4950383.html 解決: 程式碼: <!-- 執行"取消收藏" 操作 -> 根據前端傳入的商品id和sessio
[Err] 1093 - You can't specify target table 's1_test' for update in FROM clause
前提說明:資料庫採用的是mysql。 資料庫表格: 題目: 刪除除了編號不同,其他資訊都相同的冗餘資訊。 思路: 1.找出除了編號不同,其他資訊不全相同的編號。 關鍵詞:group by……having :分組查詢,我對這個關鍵詞的理解是:不同的行之間找出列相同的一項或者
【update】update中無法用基於被更新表的子查詢,You can't specify target table 'test1' for update in FROM clause.
子查詢 src nbsp spec tab can 技術分享 例如 bubuko update中無法用基於被更新表的子查詢,You can‘t specify target table ‘test1‘ for update in FROM clause. 情況如下: (
MySQL解決報錯[Err] 1093 - You can't specify target...
做資料變更的時候經常遇到這樣的報錯 DELETE FROM ssq_contract_record WHERE LOAN_ID IN ( SELECT ssq_contract_record.LOAN_ID FROM ssq_contract_record
codis擴容報錯:[error] READONLY You can't write against a read only slave
現象:最近在做codis線上擴容時,新增多組group,每個group新增一個redis作為master,當進行auto balance或手動遷移slot時,發現要遷移的slot的狀態處於error狀態,並且一直阻塞後面要遷移的slot,最終導致proxy掛掉,無法對外提供