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

                            主站蜘蛛池模板: 老子午夜影院 | 日韩精品国产精品 | 日本精品视频在线 | 国产精品综合色区在线观看 | 精品久久久久久亚洲精品 | 美女视频网站久久 | 特黄av| 玖玖操 | 在线视频 中文字幕 | 久久一区二区三区四区 | 午夜一级黄色片 | 中文字幕欧美一区 | 亚洲一区二区三区四区av | 亚洲一级在线 | 国产免费福利在线 | 久久夜视频 | 亚洲 精品 综合 精品 自拍 | 日韩久久网 | 一区二区三区免费 | 伊人狠狠干| 国产色网 | 国产精品视频一区二区三区不卡 | 97人人澡人人爽91综合色 | 欧美日韩在线一区二区三区 | 亚洲一区国产精品 | 国产乱码久久久久久一区二区 | 免费在线观看一区二区 | 在线免费av观看 | 黄色成人免费在线观看 | 三级视频在线观看电影 | 一二区电影| 免费观看的av | 黄色大片在线免费观看 | 337p日本欧洲亚洲大胆精蜜臀 | 久久久美女 | 成人性生交大片免费看中文带字幕 | 91久久精品日日躁夜夜躁国产 | 日韩精品在线看 | 97国产精品 | 999免费观看视频 | 国产一区二区精品在线观看 |