<bdo id='tQV10'></bdo><ul id='tQV10'></ul>
    1. <tfoot id='tQV10'></tfoot>

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

      1. <legend id='tQV10'><style id='tQV10'><dir id='tQV10'><q id='tQV10'></q></dir></style></legend>

      2. <small id='tQV10'></small><noframes id='tQV10'>

      3. mysql 选择更新

        时间:2023-08-20

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

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

                • <bdo id='KuacI'></bdo><ul id='KuacI'></ul>

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

                    <tbody id='KuacI'></tbody>
                  本文介绍了mysql 选择更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  明白了:

                  Table a
                  ID RelatedBs
                  1  NULL
                  2  NULL
                  
                  Table b
                  AID ID
                  1   1
                  1   2
                  1   3
                  2   4
                  2   5
                  2   6
                  

                  需要表 a 具有表 b 中给出的逗号分隔列表.然后表 b 将过时:

                  Need Table a to have a comma separated list as given in table b. And then table b will become obsolete:

                  Table a
                  ID RelatedBs
                  1  1,2,3
                  2  4,5,6
                  

                  这不会遍历所有记录,而只是将一个 'b' 添加到 'table a'

                  This does not rund through all records, but just ad one 'b' to 'table a'

                  UPDATE a, b
                  SET relatedbs = CONCAT(relatedbs,',',b.id)
                  WHERE a.id = b.aid
                  

                  更新:谢谢,3 个正确答案(标记为最旧的答案)!GROUP_CONCAT 是要使用的.无需使用由 GROUP_CONCAT 自动完成的 relatedids = CONCAT(relatedids,',',next_id) 在 id 之间插入逗号.

                  UPDATE: Thanks, 3 correct answers (marked oldest as answer)! GROUP_CONCAT is the one to use. No need to insert commas between the ids using relatedids = CONCAT(relatedids,',',next_id) that is done automatic by GROUP_CONCAT.

                  推荐答案

                  您必须使用 mysql group_concat 函数才能实现此目的:http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html#function_group-concat

                  You'll have to use the mysql group_concat function in order to achieve this: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html#function_group-concat

                  这篇关于mysql 选择更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:创建/附加表,其中包含按不同类别分组的值的总 下一篇:将两个垂直表合并到一个水平表

                  相关文章

                  最新文章

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

                  <tfoot id='FqBNL'></tfoot>

                    1. <small id='FqBNL'></small><noframes id='FqBNL'>