久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='dLvT3'></tfoot>

        <legend id='dLvT3'><style id='dLvT3'><dir id='dLvT3'><q id='dLvT3'></q></dir></style></legend>

        <i id='dLvT3'><tr id='dLvT3'><dt id='dLvT3'><q id='dLvT3'><span id='dLvT3'><b id='dLvT3'><form id='dLvT3'><ins id='dLvT3'></ins><ul id='dLvT3'></ul><sub id='dLvT3'></sub></form><legend id='dLvT3'></legend><bdo id='dLvT3'><pre id='dLvT3'><center id='dLvT3'></center></pre></bdo></b><th id='dLvT3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dLvT3'><tfoot id='dLvT3'></tfoot><dl id='dLvT3'><fieldset id='dLvT3'></fieldset></dl></div>
          <bdo id='dLvT3'></bdo><ul id='dLvT3'></ul>

        <small id='dLvT3'></small><noframes id='dLvT3'>

        MySQL 錯誤 1093 - 無法在 FROM 子句中指定更新的目標

        MySQL Error 1093 - Can#39;t specify target table for update in FROM clause(MySQL 錯誤 1093 - 無法在 FROM 子句中指定更新的目標表)
        <i id='OhcaR'><tr id='OhcaR'><dt id='OhcaR'><q id='OhcaR'><span id='OhcaR'><b id='OhcaR'><form id='OhcaR'><ins id='OhcaR'></ins><ul id='OhcaR'></ul><sub id='OhcaR'></sub></form><legend id='OhcaR'></legend><bdo id='OhcaR'><pre id='OhcaR'><center id='OhcaR'></center></pre></bdo></b><th id='OhcaR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='OhcaR'><tfoot id='OhcaR'></tfoot><dl id='OhcaR'><fieldset id='OhcaR'></fieldset></dl></div>
            • <bdo id='OhcaR'></bdo><ul id='OhcaR'></ul>
              <tfoot id='OhcaR'></tfoot>
                  <tbody id='OhcaR'></tbody>

                <small id='OhcaR'></small><noframes id='OhcaR'>

                <legend id='OhcaR'><style id='OhcaR'><dir id='OhcaR'><q id='OhcaR'></q></dir></style></legend>
                  本文介紹了MySQL 錯誤 1093 - 無法在 FROM 子句中指定更新的目標表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我的數(shù)據(jù)庫中有一個表 story_category,其中包含損壞的條目.下一個查詢返回損壞的條目:

                  I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries:

                  SELECT * 
                  FROM  story_category 
                  WHERE category_id NOT IN (
                      SELECT DISTINCT category.id 
                      FROM category INNER JOIN 
                         story_category ON category_id=category.id);
                  

                  我試圖刪除它們執(zhí)行:

                  DELETE FROM story_category 
                  WHERE category_id NOT IN (
                      SELECT DISTINCT category.id 
                      FROM category 
                        INNER JOIN story_category ON category_id=category.id);
                  

                  但我收到下一個錯誤:

                  #1093 - 不能在 FROM 子句中為更新指定目標表story_category"

                  #1093 - You can't specify target table 'story_category' for update in FROM clause

                  我怎樣才能克服這個問題?

                  How can I overcome this?

                  推薦答案

                  更新:此答案涵蓋一般錯誤分類.有關如何最好地處理 OP 的確切查詢的更具體答案,請參閱此問題的其他答案

                  在 MySQL 中,您不能修改在 SELECT 部分使用的同一個表.
                  此行為記錄在:http://dev.mysql.com/doc/refman/5.6/en/update.html

                  In MySQL, you can't modify the same table which you use in the SELECT part.
                  This behaviour is documented at: http://dev.mysql.com/doc/refman/5.6/en/update.html

                  也許您可以將表格加入到自己的表格中

                  如果邏輯足夠簡單,可以重新調整查詢,則丟失子查詢并將表連接到自身,采用適當?shù)倪x擇標準.這將導致 MySQL 將表視為兩種不同的事物,從而允許進行破壞性更改.

                  If the logic is simple enough to re-shape the query, lose the subquery and join the table to itself, employing appropriate selection criteria. This will cause MySQL to see the table as two different things, allowing destructive changes to go ahead.

                  UPDATE tbl AS a
                  INNER JOIN tbl AS b ON ....
                  SET a.col = b.col
                  

                  或者,嘗試將子查詢更深入地嵌套到 from 子句中...

                  如果您絕對需要子查詢,有一個解決方法,但它是丑陋的原因有很多,包括性能:

                  If you absolutely need the subquery, there's a workaround, but it's ugly for several reasons, including performance:

                  UPDATE tbl SET col = (
                    SELECT ... FROM (SELECT.... FROM) AS x);
                  

                  FROM 子句中的嵌套子查詢創(chuàng)建了一個隱式臨時表,因此它不算作您正在更新的同一個表.

                  The nested subquery in the FROM clause creates an implicit temporary table, so it doesn't count as the same table you're updating.

                  ...但要注意查詢優(yōu)化器

                  但是,請注意 MySQL5.7.6 及以后,優(yōu)化器可能會優(yōu)化出子查詢,但仍然會出現(xiàn)錯誤.幸運的是,optimizer_switch 變量可用于關閉此行為;盡管我不建議將其作為短期解決方案或一次性小任務.

                  However, beware that from MySQL 5.7.6 and onward, the optimiser may optimise out the subquery, and still give you the error. Luckily, the optimizer_switch variable can be used to switch off this behaviour; although I couldn't recommend doing this as anything more than a short term fix, or for small one-off tasks.

                  SET optimizer_switch = 'derived_merge=off';
                  

                  感謝 Peter V. M?rch 在評論中提供的建議.

                  Thanks to Peter V. M?rch for this advice in the comments.

                  示例技術來自 Baron Schwartz,最初發(fā)表于 Nabble,在此處進行了釋義和擴展.

                  Example technique was from Baron Schwartz, originally published at Nabble, paraphrased and extended here.

                  這篇關于MySQL 錯誤 1093 - 無法在 FROM 子句中指定更新的目標表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數(shù)根據(jù) N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數(shù)的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發(fā)技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環(huán)數(shù)組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發(fā)生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數(shù)據(jù)庫表作為 Spark 數(shù)據(jù)幀讀取?)
                    <tbody id='5zEO1'></tbody>
                    <bdo id='5zEO1'></bdo><ul id='5zEO1'></ul>

                  • <small id='5zEO1'></small><noframes id='5zEO1'>

                    <i id='5zEO1'><tr id='5zEO1'><dt id='5zEO1'><q id='5zEO1'><span id='5zEO1'><b id='5zEO1'><form id='5zEO1'><ins id='5zEO1'></ins><ul id='5zEO1'></ul><sub id='5zEO1'></sub></form><legend id='5zEO1'></legend><bdo id='5zEO1'><pre id='5zEO1'><center id='5zEO1'></center></pre></bdo></b><th id='5zEO1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5zEO1'><tfoot id='5zEO1'></tfoot><dl id='5zEO1'><fieldset id='5zEO1'></fieldset></dl></div>
                      <tfoot id='5zEO1'></tfoot>

                        <legend id='5zEO1'><style id='5zEO1'><dir id='5zEO1'><q id='5zEO1'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 欧美日韩综合视频 | 国产美女视频黄 | 日韩精品免费在线观看 | 亚洲免费精品 | 国产一区二区三区亚洲 | 精品伊人久久 | 黄色小视频入口 | 亚洲午夜精品在线观看 | 天堂一区在线观看 | 在线免费观看亚洲 | 91亚洲精品国偷拍自产在线观看 | sese视频在线观看 | 夜操| 国产精品99久久久久久动医院 | 日韩中文一区二区三区 | 婷婷久久精品一区二区 | 在线免费亚洲视频 | 日本成人福利视频 | 国产亚洲精品a | 午夜国产一级片 | 欧日韩在线观看 | 欧美一级大片 | 欧美中文字幕在线观看 | 狠狠色综合欧美激情 | 欧美中文字幕一区 | 99精品视频在线观看免费播放 | 一级做a爰片性色毛片16 | 中文字幕精品一区二区三区精品 | 中文字幕高清免费日韩视频在线 | 国产精品国产三级国产aⅴ中文 | 毛片免费观看 | 一本一道久久a久久精品综合蜜臀 | 国产视频中文字幕 | www国产成人免费观看视频,深夜成人网 | 超碰在线免费公开 | 午夜精品久久 | 午夜成人免费视频 | 欧美日韩看片 | 国产一区二区不卡 | 亚洲国产成人av好男人在线观看 | 91福利在线观看 |