<tfoot id='DDNwq'></tfoot>
      <legend id='DDNwq'><style id='DDNwq'><dir id='DDNwq'><q id='DDNwq'></q></dir></style></legend>

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

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

        • <bdo id='DDNwq'></bdo><ul id='DDNwq'></ul>
      1. mysql 选择不同的行到逗号分隔的列表列中

        mysql select distinct rows into a comma delimited list column(mysql 选择不同的行到逗号分隔的列表列中)

              <legend id='7iqkQ'><style id='7iqkQ'><dir id='7iqkQ'><q id='7iqkQ'></q></dir></style></legend>

              <small id='7iqkQ'></small><noframes id='7iqkQ'>

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

                  本文介绍了mysql 选择不同的行到逗号分隔的列表列中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我目前有一些带回标签的 sql.他们应该有不同的 id,但他们没有......所以我当前的数据是这样的:

                  I currently have some sql that brings back tags. they should have distinct ids, but they don't.... so my current data is like:

                  Microsoft | GGG | 1 | 167
                  Microsoft | GGG | 1 | 2
                  Microsoft | GGG | 1 | 1
                  

                  我想要做的是只返回一行,最后一列连接成一个分隔列表,如:

                  What i would like to do is have only one row come back with the final column concatenated into a delimited list like:

                  Microsoft | GGG | 1 | 167, 2, 1
                  

                  我为此使用了 mySQL 5.

                  I am using mySQL 5 for this.

                  推荐答案

                  使用 GROUP_CONCAT() 为此,GROUP BY 覆盖其他三列:

                  Use GROUP_CONCAT() for this, with a GROUP BY covering the other three columns:

                  SELECT 
                    name,   -- Microsoft
                    other,  -- GGG
                    other2, -- 1
                    GROUP_CONCAT(id) AS ids
                  FROM tbl
                  GROUP BY name, other, other2
                  

                  这篇关于mysql 选择不同的行到逗号分隔的列表列中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to delete duplicate records in mysql database?(如何删除mysql数据库中的重复记录?)
                  Python Pandas write to sql with NaN values(Python Pandas 使用 NaN 值写入 sql)
                  MySQL Insert amp; Joins(MySQL 插入 amp;加入)
                  MySQL concat() to create column names to be used in a query?(MySQL concat() 创建要在查询中使用的列名?)
                  NodeJS responded MySQL timezone is different when I fetch directly from MySQL(当我直接从 MySQL 获取时,NodeJS 响应 MySQL 时区不同)
                  WHERE datetime older than some time (eg. 15 minutes)(WHERE 日期时间早于某个时间(例如 15 分钟))
                      <tbody id='MlsTN'></tbody>

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

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

                          • <small id='MlsTN'></small><noframes id='MlsTN'>