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

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

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

      1. SQL 平均(計數(*))?

        SQL AVG(COUNT(*))?(SQL 平均(計數(*))?)
          <tfoot id='Ttbzd'></tfoot>
            1. <legend id='Ttbzd'><style id='Ttbzd'><dir id='Ttbzd'><q id='Ttbzd'></q></dir></style></legend>

            2. <small id='Ttbzd'></small><noframes id='Ttbzd'>

                <tbody id='Ttbzd'></tbody>
                <bdo id='Ttbzd'></bdo><ul id='Ttbzd'></ul>

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

                2. 本文介紹了SQL 平均(計數(*))?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我試圖找出一個值在列中出現的平均次數,根據另一列對其進行分組,然后對其進行計算.

                  I'm trying to find out the average number of times a value appears in a column, group it based on another column and then perform a calculation on it.

                  我有 3 張桌子,有點像這樣

                  I have 3 tables a little like this

                  DVD
                  
                  ID | NAME
                  1  | 1       
                  2  | 1     
                  3  | 2      
                  4  | 3
                  
                  COPY 
                  
                  ID | DVDID   
                  1  | 1  
                  2  | 1  
                  3  | 2  
                  4  | 3  
                  5  | 1
                  
                  LOAN
                  
                  ID | DVDID | COPYID  
                  1  | 1     |  1  
                  2  | 1     |  2  
                  3  | 2     |  3    
                  4  | 3     |  4  
                  5  | 1     |  5
                  6  | 1     |  5
                  7  | 1     |  5
                  8  | 1     |  2
                  

                  基本上,我試圖找到出借表中出現的所有副本 ID,其次數少于該 DVD 的所有副本的平均次數.

                  Basically, I'm trying to find all the copy ids that appear in the loan table LESS times than the average number of times for all copies of that DVD.

                  因此在上面的示例中,dvd 1 的副本 5 出現了 3 次,副本 2 兩次,副本 1 一次,因此該 DVD 的平均值為 2.我想列出該 DVD 的所有副本(以及每個副本)在 Loan 表中出現的數字小于該數字.

                  So in the example above, copy 5 of dvd 1 appears 3 times, copy 2 twice and copy 1 once so the average for that DVD is 2. I want to list all the copies of that (and each other) dvd that appear less than that number in the Loan table.

                  我希望這更有意義...

                  I hope that makes a bit more sense...

                  謝謝

                  推薦答案

                  類似于 dotjoe 的解決方案,但使用解析函數來避免額外的連接.可能或多或少有效率.

                  Similar to dotjoe's solution, but using an analytic function to avoid the extra join. May be more or less efficient.

                  with 
                  loan_copy_total as 
                  (
                      select dvdid, copyid, count(*) as cnt
                      from loan
                      group by dvdid, copyid
                  ),
                  loan_copy_avg as
                  (
                      select dvdid, copyid, cnt, avg(cnt) over (partition by dvdid) as copy_avg
                      from loan_copy_total
                  )
                  select *
                  from loan_copy_avg lca
                  where cnt <= copy_avg;
                  

                  這篇關于SQL 平均(計數(*))?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress)
                  Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數據庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發
                  How to create a login to a SQL Server instance?(如何創建對 SQL Server 實例的登錄?)
                  How to know the version and edition of SQL Server through registry search(如何通過注冊表搜索知道SQL Server的版本和版本)
                  Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會出現“數據類型轉換錯誤?使用 ExecuteNonQuery()?)
                  How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)
                3. <legend id='ayqo7'><style id='ayqo7'><dir id='ayqo7'><q id='ayqo7'></q></dir></style></legend>

                  <tfoot id='ayqo7'></tfoot>

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

                            主站蜘蛛池模板: 黄色一级片免费看 | 日本不卡视频在线观看 | 黄色xxxxx| 免费毛片视频 | 久久精品福利 | 9l视频自拍九色9l视频成人 | 看国产毛片 | 精品免费国产一区二区三区四区 | 国产福利在线视频 | 日韩一区二区三区在线播放 | 182tv午夜 | 欧美在线中文字幕 | 欧美日韩免费在线观看 | 国产无遮挡又黄又爽又色 | 亚洲午夜精品 | 国产美女免费视频 | 国产毛片一级 | 日韩毛片视频 | 在线性视频 | 自拍偷拍欧美日韩 | 99精品久久 | 欧美 日韩 国产 成人 在线 | 日日不卡av| 日日操日日射 | 国产一区在线播放 | 天海翼一区二区 | 日韩精品免费一区二区夜夜嗨 | 中文一区二区 | 中文字幕不卡 | 亚洲综合视频在线观看 | 久久国产影院 | 中国久久久 | 天天天天天操 | 亚洲在线播放 | 欧美一区二区三区在线观看 | 国产美女免费 | 色婷婷av一区二区三区之e本道 | 97精品视频在线观看 | 天天综合天天做天天综合 | 国产精品日韩欧美 | 中文字幕不卡视频 |