久久久久久久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>

                            主站蜘蛛池模板: 九九亚洲精品 | 亚洲精品国产第一综合99久久 | 男女那个视频 | 亚洲精品久久久蜜桃 | 久久天天躁狠狠躁夜夜躁2014 | 精品av | 国产一级特黄视频 | 亚洲一区二区精品视频 | 欧美v片 | 日本a视频| 久久国产成人 | 在线日韩| 国产成人免费视频网站高清观看视频 | 午夜久久久| 欧美成人h版在线观看 | 久日精品| 日韩在线观看精品 | 中文字幕av亚洲精品一部二部 | 干出白浆视频 | 国产欧美日韩在线观看 | 91视频中文 | 欧美激情一区二区 | 亚洲精品视频观看 | 日韩快播电影 | 久久国产高清视频 | 亚洲成人精品国产 | 久久中文字幕一区 | 黄色大片视频 | 亚洲国产精品99久久久久久久久 | 免费在线毛片 | 一本色道久久综合亚洲精品高清 | 欧美日韩电影一区二区 | 婷婷综合久久 | 亚洲免费视频在线观看 | 精品美女久久久 | 中文字幕 视频一区 | 欧美福利久久 | 国产精品免费一区二区三区四区 | 欧美黑人体内she精在线观看 | 国产高清在线精品一区二区三区 | 99久久国产免费 |