In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to achieve grouping aggregation in partition". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to achieve grouping aggregation in partition".
Select * from (select o.order_id, o.user_id, o.amount_money, o.order_date, o.update_date row_number () over (partition by o.order_id, o.user_id order by o.update_date desc) RANK from order o) tmp where tmp.RANK = 1
Example (when the business database processes to the data warehouse every day, it is not reprocessed):
Order_iduser_idamount_moneyorder_dateupdate_date11202020-09-222020-09-2311202020-09-222020-09-2432402020-09-222020-09-2342502020-09-222020-09-23
Unfiltered query results:
Order_iduser_idamount_moneyorder_dateupdate_daterank11202020-09-222020-09-23211202020-09-222020-24132402020-09-222020-09-23142502020-09-222020-09-231
Query results after filtering (where tmp.RANK = 1):
Order_iduser_idamount_moneyorder_dateupdate_daterank11202020-09-222020-09-24132402020-09-222020-09-23142502020-09-222020-09-231
Note: this grouping aggregation is not very time-consuming and is almost the same as without this windowing function.
Thank you for your reading, the above is the content of "how to achieve grouping aggregation in partition". After the study of this article, I believe you have a deeper understanding of how to achieve grouping aggregation in partition, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.