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

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

      2. <legend id='NHxPG'><style id='NHxPG'><dir id='NHxPG'><q id='NHxPG'></q></dir></style></legend>

        如何在 MySQL 的 CONCAT 中使用 GROUP_CONCAT

        How to use GROUP_CONCAT in a CONCAT in MySQL(如何在 MySQL 的 CONCAT 中使用 GROUP_CONCAT)
          <tbody id='ASUgz'></tbody>
        <tfoot id='ASUgz'></tfoot>

            <legend id='ASUgz'><style id='ASUgz'><dir id='ASUgz'><q id='ASUgz'></q></dir></style></legend>
              • <small id='ASUgz'></small><noframes id='ASUgz'>

                • <bdo id='ASUgz'></bdo><ul id='ASUgz'></ul>
                  <i id='ASUgz'><tr id='ASUgz'><dt id='ASUgz'><q id='ASUgz'><span id='ASUgz'><b id='ASUgz'><form id='ASUgz'><ins id='ASUgz'></ins><ul id='ASUgz'></ul><sub id='ASUgz'></sub></form><legend id='ASUgz'></legend><bdo id='ASUgz'><pre id='ASUgz'><center id='ASUgz'></center></pre></bdo></b><th id='ASUgz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ASUgz'><tfoot id='ASUgz'></tfoot><dl id='ASUgz'><fieldset id='ASUgz'></fieldset></dl></div>
                  本文介紹了如何在 MySQL 的 CONCAT 中使用 GROUP_CONCAT的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  如果我在 MySQL 中有一個包含以下數據的表:

                  If I have a table with the following data in MySQL:

                  id       Name       Value
                  1          A          4
                  1          A          5
                  1          B          8
                  2          C          9
                  

                  如何將其轉換為以下格式?

                  how do I get it into the following format?

                  id         Column
                  1          A:4,5,B:8
                  2          C:9
                  


                  我想我必須使用 GROUP_CONCAT.但我不確定它是如何工作的.


                  I think I have to use GROUP_CONCAT. But I'm not sure how it works.

                  推薦答案

                  select id, group_concat(`Name` separator ',') as `ColumnName`
                  from
                  (
                    select 
                      id, 
                      concat(`Name`, ':', group_concat(`Value` separator ',')) as `Name`
                    from mytbl
                    group by 
                      id, 
                      `Name`
                  ) tbl
                  group by id;
                  

                  你可以在這里看到它的實現:Sql Fiddle Demo.正是您所需要的.

                  You can see it implemented here : Sql Fiddle Demo. Exactly what you need.

                  更新分兩步拆分.首先,我們得到一個表,其中包含針對唯一 [Name,id] 的所有值(逗號分隔).然后從獲得的表中,我們將所有名稱和值作為針對每個唯一 id 的單個值請參閱此處的說明 SQL Fiddle Demo(向下滾動有兩個結果集)

                  Update Splitting in two steps. First we get a table having all values(comma separated) against a unique[Name,id]. Then from obtained table we get all names and values as a single value against each unique id See this explained here SQL Fiddle Demo (scroll down as it has two result sets)

                  編輯 閱讀問題時出錯,我僅按 id 分組.但是如果(值要按名稱和 id 分組,然后按 id 分組),則需要兩個 group_contacts.以前的答案是

                  Edit There was a mistake in reading question, I had grouped only by id. But two group_contacts are needed if (Values are to be concatenated grouped by Name and id and then over all by id). Previous answer was

                  select 
                  id,group_concat(concat(`name`,':',`value`) separator ',')
                  as Result from mytbl group by id
                  

                  你可以在這里看到它的實現:SQL Fiddle Demo

                  You can see it implemented here : SQL Fiddle Demo

                  這篇關于如何在 MySQL 的 CONCAT 中使用 GROUP_CONCAT的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 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 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)

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

                        <tfoot id='pAP5j'></tfoot>

                            <tbody id='pAP5j'></tbody>

                            主站蜘蛛池模板: 日一区二区 | 国产激情毛片 | 国产高清在线观看 | 青青激情网 | 91精品在线看 | 亚洲精品一区二区 | 免费不卡av | 国产黄色电影 | 久久精品视频在线观看 | 欧美精品在线免费观看 | 欧美激情久久久 | 91精品久久久久久久久99蜜臂 | 中文字幕亚洲欧美 | 超碰在线免费 | 天堂综合 | 九九亚洲| 三级黄色片在线 | 亚洲精品一区二区三区免 | 黄色在线免费观看 | 99精品在线 | 欧美国产日韩在线 | 国产精品欧美日韩 | 国户精品久久久久久久久久久不卡 | 九九久视频| 深夜福利亚洲 | 天堂一区 | 日韩亚洲一区二区 | 夜夜操天天艹 | 亚洲一区二区免费视频 | 黄a网站 | 精品乱码一区二区 | 亚洲有码转帖 | 日韩精品中文字幕一区二区三区 | 99热播精品 | 中文字幕中文字幕 | 国产一区电影 | 亚洲精品乱码久久久久久按摩 | 久久高清精品 | 亚洲精品视频一区二区三区 | 日韩综合一区 | 久久精品成人一区 |