久久久久久久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 平均(計(jì)數(shù)(*))?

        SQL AVG(COUNT(*))?(SQL 平均(計(jì)數(shù)(*))?)
          <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 平均(計(jì)數(shù)(*))?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我試圖找出一個(gè)值在列中出現(xiàn)的平均次數(shù),根據(jù)另一列對(duì)其進(jìn)行分組,然后對(duì)其進(jìn)行計(jì)算.

                  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 張桌子,有點(diǎn)像這樣

                  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
                  

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

                  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 出現(xiàn)了 3 次,副本 2 兩次,副本 1 一次,因此該 DVD 的平均值為 2.我想列出該 DVD 的所有副本(以及每個(gè)副本)在 Loan 表中出現(xiàn)的數(shù)字小于該數(shù)字.

                  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 的解決方案,但使用解析函數(shù)來避免額外的連接.可能或多或少有效率.

                  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;
                  

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

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

                  相關(guān)文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產(chǎn)品、類別和元數(shù)據(jù)的 SQL 查詢 woocommerce/wordpress)
                  Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數(shù)據(jù)庫列表和 SQL Server 實(shí)例使用的空間嗎?) - IT屋-程序員軟件開發(fā)
                  How to create a login to a SQL Server instance?(如何創(chuàng)建對(duì) SQL Server 實(shí)例的登錄?)
                  How to know the version and edition of SQL Server through registry search(如何通過注冊(cè)表搜索知道SQL Server的版本和版本)
                  Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會(huì)出現(xiàn)“數(shù)據(jù)類型轉(zhuǎn)換錯(cuò)誤?使用 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'>

                            主站蜘蛛池模板: 亚洲香蕉在线视频 | 欧美高清视频在线观看 | 黄色在线观看国产 | 久久精品国产一区 | 黄色毛片免费看 | 欧美成人第一页 | 欧美精品日韩精品国产精品 | 欧美在线不卡 | 一级免费a | 四虎影视在线 | 婷婷毛片 | 亚洲入口 | 久久精品欧美一区二区三区麻豆 | 国产视频一区二区三区四区五区 | 亚洲精品9999| 国产视频一二三区 | 高清亚洲 | 日韩高清中文字幕 | 国产综合久久久 | 久久国产日韩欧美 | 天天拍天天射 | 国产专区在线 | 在线播放精品视频 | 嫩草视频网站 | 欧美视频在线播放 | 欧美一区二区三区久久精品视 | 欧美v日韩 | 欧美久久一区 | 在线播放亚洲 | 欧美综合在线视频 | 国产亚洲一区二区精品 | 亚洲乱码一区二区 | 国产精品亚洲综合 | 亚洲午夜精品视频 | 亚洲欧美一区二区三区1000 | 免费在线观看一级毛片 | 成人免费观看男女羞羞视频 | 中文字幕亚洲无线 | 国产精品久久久久久久7777 | 午夜国产| 欧美日韩中文国产一区发布 |