1. <legend id='26wio'><style id='26wio'><dir id='26wio'><q id='26wio'></q></dir></style></legend><tfoot id='26wio'></tfoot>

      <small id='26wio'></small><noframes id='26wio'>

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

          <bdo id='26wio'></bdo><ul id='26wio'></ul>
      1. 使用同一表中另一行的数据更新行

        Update row with data from another row in the same table(使用同一表中另一行的数据更新行)

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

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

                <tbody id='rmFNu'></tbody>

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

                1. 本文介绍了使用同一表中另一行的数据更新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!




                  I've got a table which looks something like this

                  ID   |   NAME    |  VALUE  |
                   1   |   Test    |  VALUE1 |
                   2   |   Test2   |  VALUE2 |
                   1   |   Test2   |         |
                   4   |   Test    |         |
                   1   |   Test3   |  VALUE3 |

                  我正在寻找一种方法来更新值 'Test2' 和 'Test' 与来自'VALUE' 列中具有相同'NAME' 的其他行的数据(ID 在这里不是唯一的,复合键ID 和 NAME 使一行唯一).例如,我正在寻找的输出是:

                  I'm looking for a way to update the values 'Test2' and 'Test' with the data from other rows in the 'VALUE' column with the same 'NAME' (The ID is not unique here, a composite key of the ID and NAME make a row unique). For example, the output I'm looking for is:

                  ID   |   NAME    |  VALUE  |
                   1   |   Test    |  VALUE1 |
                   2   |   Test2   |  VALUE2 |
                   1   |   Test2   |  VALUE2 |
                   4   |   Test    |  VALUE1 |
                   1   |   Test3   |  VALUE3 |

                  如果它在另一个表中,我会很好,但我不知道如何引用当前表中具有相同 NAME 值的不同行.

                  If it was in another table I'd be fine, but I'm at a loss as to how I can reference a different row within the current table with the same NAME value.


                  修改 manji 查询后,以下是我用于工作解决方案的查询.谢谢大家!

                  After modifying manji query, below is the query I used for a working solution. Thanks all!

                  UPDATE data_table dt1, data_table dt2 
                  SET dt1.VALUE = dt2.VALUE 
                  WHERE dt1.NAME = dt2.NAME AND dt1.VALUE = '' AND dt2.VALUE != '' 



                  UPDATE data_table t, (SELECT DISTINCT ID, NAME, VALUE
                                          FROM data_table
                                         WHERE VALUE IS NOT NULL AND VALUE != '') t1
                     SET t.VALUE = t1.VALUE
                   WHERE t.ID = t1.ID
                     AND t.NAME = t1.NAME




                  Can#39;t Create Entity Data Model - using MySql and EF6(无法创建实体数据模型 - 使用 MySql 和 EF6)
                  MySQL select with CONCAT condition(MySQL选择与CONCAT条件)
                  Capitalize first letter of each word, in existing table(将现有表格中每个单词的首字母大写)
                  How to retrieve SQL result column value using column name in Python?(如何在 Python 中使用列名检索 SQL 结果列值?)
                  Exporting results of a Mysql query to excel?(将 Mysql 查询的结果导出到 excel?)
                  DOUBLE vs DECIMAL in MySQL(MySQL 中的 DOUBLE 与 DECIMAL)

                      <tbody id='5wslZ'></tbody>
                  • <legend id='5wslZ'><style id='5wslZ'><dir id='5wslZ'><q id='5wslZ'></q></dir></style></legend>
                    <i id='5wslZ'><tr id='5wslZ'><dt id='5wslZ'><q id='5wslZ'><span id='5wslZ'><b id='5wslZ'><form id='5wslZ'><ins id='5wslZ'></ins><ul id='5wslZ'></ul><sub id='5wslZ'></sub></form><legend id='5wslZ'></legend><bdo id='5wslZ'><pre id='5wslZ'><center id='5wslZ'></center></pre></bdo></b><th id='5wslZ'></th></span></q></dt></tr></i><div id='5wslZ'><tfoot id='5wslZ'></tfoot><dl id='5wslZ'><fieldset id='5wslZ'></fieldset></dl></div>

                      <tfoot id='5wslZ'></tfoot>
                            <bdo id='5wslZ'></bdo><ul id='5wslZ'></ul>

                            <small id='5wslZ'></small><noframes id='5wslZ'>