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

    <bdo id='i1sFx'></bdo><ul id='i1sFx'></ul>
<tfoot id='i1sFx'></tfoot>

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

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

      <legend id='i1sFx'><style id='i1sFx'><dir id='i1sFx'><q id='i1sFx'></q></dir></style></legend>

        將兩個垂直表合并到一個水平表

        Merging two vertical tables onto one horizontal table(將兩個垂直表合并到一個水平表)
          <tbody id='Gh7Mp'></tbody>
          <bdo id='Gh7Mp'></bdo><ul id='Gh7Mp'></ul>

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

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

          <legend id='Gh7Mp'><style id='Gh7Mp'><dir id='Gh7Mp'><q id='Gh7Mp'></q></dir></style></legend>

                  本文介紹了將兩個垂直表合并到一個水平表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  表格定義

                  Table 1 (horizo??ntal) 這是一個用戶表

                  Table 1 (horizontal) This is a table of users

                  | id | name | phone |
                  ---------------------
                  | 1  | Bob  | 800   |
                  | 2  | Phil | 800   | 
                  

                  Table 2 (Vertical Table) 這是一個團隊表

                  Table 2 (Vertical Table) This is a table of teams

                  | id | name      |
                  ------------------
                  | 1  | Donkey    |
                  | 2  | Cat       |  
                  

                  Table 3 (Vertical Table) 此表連接前兩個

                  Table 3 (Vertical Table) This table is connecting the first two

                  | id | user_id | team_id |
                  --------------------------
                  | 1  |    1    |   1     |
                  | 2  |    1    |   2     |
                  | 3  |    2    |   1     |
                  

                  <小時>

                  我的目標

                  我希望能夠以返回以下信息的方式查詢數據:

                  I would like to be able to query the data in such a way that i get the following back:

                  | id | name | phone | Donkey | Cat  |
                  -------------------------------------
                  | 1  | Bob  | 800   | 1      | 1    |
                  | 2  | Phil | 800   | 1      | Null |
                  

                  此表將包含我的水平表數據,然后是其他兩個垂直表的組合以創建附加列.表 2 最終成為列名標題.并且行值作為布爾值從表三中提取.

                  This table would have my horizontal table data, then a combination of the other two vertical tables to create the appended columns. Where table 2 ends up being the column name headings. And the row valus are pulled from table three as a boolean.

                  推薦答案

                  您正在尋找數據透視表:

                  You're chasing a pivot table:

                  select u.*, 
                    sum(case when t1.name = 'Donkey' then 1 else 0 end) Donkey, 
                    sum(case when t1.name = 'Cat' then 1 else 0 end) Cat
                    from users u
                      inner join user_team ut1
                        on u.id = ut1.user_id  
                      inner join teams t1
                        on ut1.team_id = t1.id
                    group by name
                  

                  演示:http://sqlfiddle.com/#!9/5fd33/7

                  這篇關于將兩個垂直表合并到一個水平表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 數據幀讀取?)

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

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

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

                            主站蜘蛛池模板: 天堂久 | 四虎影视1304t | 九色91视频 | 国产激情一区二区三区 | 中文字幕av色 | 不卡视频一区 | 国产乱码精品一区二区三区忘忧草 | 亚洲精品专区 | 精品久久久久香蕉网 | 精品久久久久一区二区国产 | 色综合一区二区 | 亚洲免费av一区 | 天天草天天干天天 | 久久久久国产一区二区三区不卡 | 91原创视频| 久久久久久高潮国产精品视 | 日本在线播放一区二区 | 黄色免费在线观看网址 | 亚洲 精品 综合 精品 自拍 | 精品国产伦一区二区三区观看方式 | 中文字幕视频三区 | 欧美日韩1区2区 | 精品三级在线观看 | 国产视频精品免费 | 欧美日韩亚洲在线 | 亚洲 自拍 另类 欧美 丝袜 | 成人精品一区二区 | 99这里只有精品 | 欧美日韩成人影院 | 可以免费观看的av | 欧美性精品 | 狠狠艹| 99re6在线视频精品免费 | 久久久久久久久久影视 | 欧美一区二区三区电影 | 午夜免费在线观看 | 日韩欧美手机在线 | 亚洲精品视频在线看 | 亚洲色欧美另类 | 五月综合激情婷婷 | 国产精品久久久久久久久久久免费看 |