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

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

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

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

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

      SQL 將值拆分為多行

      SQL split values to multiple rows(SQL 將值拆分為多行)

              <bdo id='2lBTb'></bdo><ul id='2lBTb'></ul>
              <legend id='2lBTb'><style id='2lBTb'><dir id='2lBTb'><q id='2lBTb'></q></dir></style></legend>
              <tfoot id='2lBTb'></tfoot>
            • <small id='2lBTb'></small><noframes id='2lBTb'>

              <i id='2lBTb'><tr id='2lBTb'><dt id='2lBTb'><q id='2lBTb'><span id='2lBTb'><b id='2lBTb'><form id='2lBTb'><ins id='2lBTb'></ins><ul id='2lBTb'></ul><sub id='2lBTb'></sub></form><legend id='2lBTb'></legend><bdo id='2lBTb'><pre id='2lBTb'><center id='2lBTb'></center></pre></bdo></b><th id='2lBTb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2lBTb'><tfoot id='2lBTb'></tfoot><dl id='2lBTb'><fieldset id='2lBTb'></fieldset></dl></div>
                  <tbody id='2lBTb'></tbody>
                本文介紹了SQL 將值拆分為多行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我有桌子:

                id | name    
                1  | a,b,c    
                2  | b
                

                我想要這樣的輸出:

                id | name    
                1  | a    
                1  | b    
                1  | c    
                2  | b
                

                推薦答案

                如果您可以創建一個數字表,其中包含從 1 到要拆分的最大字段的數字,您可以使用如下解決方案:

                If you can create a numbers table, that contains numbers from 1 to the maximum fields to split, you could use a solution like this:

                select
                  tablename.id,
                  SUBSTRING_INDEX(SUBSTRING_INDEX(tablename.name, ',', numbers.n), ',', -1) name
                from
                  numbers inner join tablename
                  on CHAR_LENGTH(tablename.name)
                     -CHAR_LENGTH(REPLACE(tablename.name, ',', ''))>=numbers.n-1
                order by
                  id, n
                

                請參閱 fiddle 此處.

                Please see fiddle here.

                如果您無法創建表,那么解決方案可以是:

                If you cannot create a table, then a solution can be this:

                select
                  tablename.id,
                  SUBSTRING_INDEX(SUBSTRING_INDEX(tablename.name, ',', numbers.n), ',', -1) name
                from
                  (select 1 n union all
                   select 2 union all select 3 union all
                   select 4 union all select 5) numbers INNER JOIN tablename
                  on CHAR_LENGTH(tablename.name)
                     -CHAR_LENGTH(REPLACE(tablename.name, ',', ''))>=numbers.n-1
                order by
                  id, n
                

                示例小提琴是這里.

                這篇關于SQL 將值拆分為多行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 數據幀讀取?)

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

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

                    2. <tfoot id='gZMQO'></tfoot>

                        <legend id='gZMQO'><style id='gZMQO'><dir id='gZMQO'><q id='gZMQO'></q></dir></style></legend>
                          <tbody id='gZMQO'></tbody>
                        • 主站蜘蛛池模板: 成年男女免费视频网站 | 亚洲高清在线观看 | 99精品热视频 | 中文字幕一区二区三区精彩视频 | 日韩免费一区 | 午夜激情免费视频 | 欧美精品久久久久 | 亚洲高清在线 | 欧美操操操 | 久久精品91久久久久久再现 | 午夜在线精品偷拍 | 亚洲国产精品99久久久久久久久 | 日韩不卡视频在线 | 亚洲天堂精品久久 | 亚洲国产成人在线 | 大陆一级毛片免费视频观看 | 国产亚洲精品久久久久动 | jvid精品资源在线观看 | 成在线人视频免费视频 | 亚洲成人久久久 | 午夜精品一区二区三区在线观看 | 一区二区三区视频在线观看 | 国产精品黄视频 | 国产一区999 | www.性色| 日本三级线观看 视频 | www.久| 国产亚洲精品美女久久久久久久久久 | 欧美一级三级在线观看 | 亚洲欧美久久 | 中文字幕第90页 | 黄色毛片在线观看 | 亚洲一区二区久久 | 国产精品a一区二区三区网址 | 男人阁久久 | 欧美高清免费 | 午夜精品导航 | 蜜桃在线播放 | 天天综合久久网 | 美女久久久久久久 | 久久精品1|