After Oracle grouping, take the first entry of each group

Data format:



The effect of grouping the first item:



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


Reprinted from: http://www.cnblogs.com/dyllove98/archive/2013/07/22/3206423.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327012016&siteId=291194637