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

                            主站蜘蛛池模板: 91精品国产91久久久久久三级 | 在线看免费 | 免费看黄色小视频 | 精品久久久久久 | 国产精品久久久久久久久久了 | 一区二区在线免费观看 | 久久99精品国产 | 亚洲成人免费观看 | 欧美激情一区 | 日韩在线看片 | 亚洲国产成人精品一区二区 | 久久久www | 精品视频网 | 成人精品免费 | 久久影院一区 | 澳门永久av免费网站 | 亚洲精品一二三区 | 久久久久国产精品一区三寸 | www.久久.com| 亚洲视频在线观看 | 国产精品久久免费观看 | 免费国产黄网站在线观看视频 | 日本 欧美 三级 高清 视频 | 国外成人在线视频 | 久久91 | 99亚洲国产精品 | 亚洲高清视频一区二区 | 日韩av在线一区二区 | 国产乱码精品1区2区3区 | 521av网站| 在线免费av电影 | 亚洲欧美中文日韩在线v日本 | 久久亚洲国产 | 日本天堂一区二区 | 国产视频91在线 | 中文字幕第一页在线 | 亚洲第1页| 蜜桃臀av一区二区三区 | 久久综合久 | 国产日韩欧美在线观看 | 国产亚洲精品精品国产亚洲综合 |