日期:2014-05-17 浏览次数:20754 次
create table t1 (f1 number(10),f2 number(10),f3 number(10),f4 number(10)); insert into t1 values (1,10,20,30); insert into t1 values (1,5,2,4); insert into t1 values (1,2,4,3); insert into t1 values (2,10,20,30); insert into t1 values (2,5,1,8); insert into t1 values (3,5,55,5); insert into t1 values (4,6,6,6); insert into t1 values (4,33,36,33); insert into t1 values (5,6,6,6); insert into t1 values (5,88,88,88); select f1,f2,f3,f4 from (select f1,f2,f3,f4,row_number() over(partition by f1 order by f1) rn from t1) where rn=1 f1 f2 f3 f4 --------------------------------------- 1 1 10 20 30 2 2 10 20 30 3 3 5 55 5 4 4 6 6 6 5 5 6 6 6