• <tfoot id='J5dfv'></tfoot>
    <legend id='J5dfv'><style id='J5dfv'><dir id='J5dfv'><q id='J5dfv'></q></dir></style></legend>
      <bdo id='J5dfv'></bdo><ul id='J5dfv'></ul>

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

      1. <i id='J5dfv'><tr id='J5dfv'><dt id='J5dfv'><q id='J5dfv'><span id='J5dfv'><b id='J5dfv'><form id='J5dfv'><ins id='J5dfv'></ins><ul id='J5dfv'></ul><sub id='J5dfv'></sub></form><legend id='J5dfv'></legend><bdo id='J5dfv'><pre id='J5dfv'><center id='J5dfv'></center></pre></bdo></b><th id='J5dfv'></th></span></q></dt></tr></i><div id='J5dfv'><tfoot id='J5dfv'></tfoot><dl id='J5dfv'><fieldset id='J5dfv'></fieldset></dl></div>

        MySQL #1093 - 你不能在 FROM 子句中为更新指定目标表“赠品"

        时间:2023-06-02
        <tfoot id='wacNA'></tfoot>
        <i id='wacNA'><tr id='wacNA'><dt id='wacNA'><q id='wacNA'><span id='wacNA'><b id='wacNA'><form id='wacNA'><ins id='wacNA'></ins><ul id='wacNA'></ul><sub id='wacNA'></sub></form><legend id='wacNA'></legend><bdo id='wacNA'><pre id='wacNA'><center id='wacNA'></center></pre></bdo></b><th id='wacNA'></th></span></q></dt></tr></i><div id='wacNA'><tfoot id='wacNA'></tfoot><dl id='wacNA'><fieldset id='wacNA'></fieldset></dl></div>
          <bdo id='wacNA'></bdo><ul id='wacNA'></ul>

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

        • <legend id='wacNA'><style id='wacNA'><dir id='wacNA'><q id='wacNA'></q></dir></style></legend>

              <tbody id='wacNA'></tbody>

                  本文介绍了MySQL #1093 - 你不能在 FROM 子句中为更新指定目标表“赠品"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我试过了:

                  UPDATE giveaways SET winner = '1' WHERE ID = (SELECT MAX(ID) FROM giveaways)
                  

                  但它给出了:

                  #1093 - 您不能在 FROM 子句中指定要更新的目标表赠品"

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

                  这个文章 似乎相关,但我无法根据我的查询进行调整.我怎样才能让它工作?

                  This article seems relevant but I can't adapt it to my query. How can I get it to work?

                  推荐答案

                  这是因为您的更新可能是周期性的...代码>假?您知道情况并非如此,但引擎却并非如此.操作中也可能对表有相反的锁.

                  This is because your update could be cyclical... what if updating that record causes something to happen which made the WHERE condition FALSE? You know that isn't the case, but the engine doesn't. There also could be opposing locks on the table in the operation.

                  我认为你可以这样做(未经测试):

                  I would think you could do it like this (untested):

                  UPDATE
                      giveaways
                  SET
                      winner = '1'
                  ORDER BY
                      id DESC
                  LIMIT 1
                  

                  阅读更多

                  这篇关于MySQL #1093 - 你不能在 FROM 子句中为更新指定目标表“赠品"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 WHERE 子句中使用 mysql SUM() 下一篇:MySQL,获取用户排名

                  相关文章

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

                    <i id='n5sqr'><tr id='n5sqr'><dt id='n5sqr'><q id='n5sqr'><span id='n5sqr'><b id='n5sqr'><form id='n5sqr'><ins id='n5sqr'></ins><ul id='n5sqr'></ul><sub id='n5sqr'></sub></form><legend id='n5sqr'></legend><bdo id='n5sqr'><pre id='n5sqr'><center id='n5sqr'></center></pre></bdo></b><th id='n5sqr'></th></span></q></dt></tr></i><div id='n5sqr'><tfoot id='n5sqr'></tfoot><dl id='n5sqr'><fieldset id='n5sqr'></fieldset></dl></div>
                  1. <tfoot id='n5sqr'></tfoot>

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

                        <bdo id='n5sqr'></bdo><ul id='n5sqr'></ul>