语法:
min | max(column1) keep (dense_rank first | last order by column2) over (partion by column3); --返回按照column3分组后,按照column2排序的结果集中第一个或最后一个最小值或最大值column1。
创建测试数据:
create table test( id number, a number, b number ); insert into test values (1,111,1 ); insert into test values (1,222,1 ); insert into test values (1,333,1 ); insert into test values (1,555,3 ); insert into test values (1,666,3 ); insert into test values (2,111,1 ); insert into test values (2,222,1 ); insert into test values (2,333,2 ); insert into test values (2,555,2 ); commit;
时间: 2024-10-25 22:17:51