In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to take out the first record of each group in oracle. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Question 1:
How to retrieve the first record of each group (× × background)
Answer:
Select t.name1 rn t.name2Magnet.zx from (select row_number () over (partition by name1 order by zx desc) rn, test.* from test) t where t.rn=1
If you use rank, your zx has the same value, so you'd better use row_number.
Question 2:
In duplicate data, take the latest piece of data Oracle of each type
Three columns of data B, C and D are shown in the figure below. The C-column data is duplicated, and the C-column data is divided into three categories, which requires the acquisition of a corresponding D-column data value of the latest data in each category (the latest piece of data in Class B data).
Answer:
Select d, b from (select d, b, max (b) over (partition by c) b_max from T1) a where b=b_max
This is the end of the article on "how to get the first record of each group in oracle". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.