Get the first data after oracle grouping

Take the first data of each group after oracle grouping:

Data Format
Insert picture description here

The effect of grouping the first article

Insert picture description here

sql:

SELECT *
FROM (SELECT ROW_NUMBER() OVER(PARTITION BY x ORDER BY y DESC) rn,
test1.*
FROM test1)
WHERE rn = 1 ;

Guess you like

Origin blog.csdn.net/weixin_39597541/article/details/103384734