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

不使用子查詢的高級分組

Advanced grouping without using a sub query(不使用子查詢的高級分組)
本文介紹了不使用子查詢的高級分組的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

這是我擁有的數據樣本.

This is a sample of the data that I have.

-ID-        -Rank-      -Type-      -Status-    -Amount-
1142474     2       Under Offer Approved    23
1148492     1       Present     Current     56
1148492     2       Under Offer Approved    3
2273605     1       Present     Current     24

ID 相同的地方我只想要排名最高的記錄.所以查詢的最終結果.

Where the ID is the same I only want the record with the highest rank. So the end result of the query.

-ID-        -Rank-      -Type-      -Status-    -Amount-
1142474     2       Under Offer Approved    23
1148492     1       Present     Current     56
2273605     1       Present     Current     24

現在獲取原始數據集是一個昂貴的操作,所以不想想要做一個按 ID 分組和然后分鐘排名,然后然后重新連接到數據集上.因此,查詢需要以另一種方式工作.

Now to get the original data set is an expensive operation, so I don't want to do a group by the ID and then mins the rank and then joins back onto the dataset again. Hence the query needs to do its work another way.

干杯安東尼

推薦答案

select t1.id
       , t1.rank
       , t1.type
       , t1.status
       , t1.amount

from   my_table t1 

       left outer join my_table as t2 
       on t1.id = t2.id 
    and 
       t2.rank < t1.rank 

where  t2.id is null

這篇關于不使用子查詢的高級分組的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個子標記轉換為具有多個分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個表創建視圖?)
Create calculated value based on calculated value inside previous row(根據前一行內的計算值創建計算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 精品国产一区久久 | 国产精品久久久久久久免费观看 | 亚洲激情在线观看 | 亚洲精品久久久久久久久久久 | 999免费视频| 精品福利视频一区二区三区 | 一级黄色片日本 | 四虎成人在线播放 | 国产在线一区二区三区 | 中文字幕一区二区三区不卡 | 欧产日产国产精品99 | 亚洲欧美在线视频 | 久久不射电影网 | 国产日韩欧美激情 | 国产精品久久久久久久久久免费看 | 欧美精品欧美精品系列 | 国产一区二区三区四区在线观看 | 亚洲午夜视频 | 国产精品综合色区在线观看 | 99久久久久久 | 日本免费在线看 | 99久久国产免费 | 9999国产精品欧美久久久久久 | 在线成人福利 | 国产在线拍偷自揄拍视频 | 在线播放日韩 | 成人免费片 | 中文在线一区二区 | 成人深夜小视频 | 色婷婷综合久久久中字幕精品久久 | 日韩久久精品 | 精品久久久久一区 | 国产美女在线播放 | 日韩欧美在线一区 | 99国产精品久久久 | 91资源在线| 天天射影院 | 欧美一区成人 | 日本aaaa | 亚洲精品乱码久久久久久9色 | 色综合激情|