SQL> Insert Into aa(IDD,one)Values('a',1);1 行 已插入SQL> Insert Into aa(IDD,one)Values('a',2);1 行 已插入SQL> Insert Into aa(IDD,one)Values('a',3);1 行 已插入SQL> Insert Into aa(IDD,one)Values('b',4);1 行 已插入SQL> Insert Into aa(IDD,one)Values('b',5);1 行 已插入SQL> select * from aa;IDD ONE TWO ---------- ---------- ---------- a 2.00 a 3.00 b 4.00 a 1.00 b 5.00 SQL> SQL> select t1.one,t2.idd from aa t1,(select Min(one) as one,idd from aa group by idd) t2 2 where t1.one=t2.one(+) 3 ; ONE IDD ---------- ---------- 1.00 a 2.00 3.00 4.00 b 5.00 SQL>
select x.a,decode(x.a,y.a,x.b,'') from tb x,(select min(a) a from tb group by b) y where x.a=y.a(+);
---------- ---------- ----------
a 2.00
a 3.00
b 4.00
a 1.00
b 5.00 SQL>
SQL> select t1.one,t2.idd from aa t1,(select Min(one) as one,idd from aa group by idd) t2
2 where t1.one=t2.one(+)
3 ; ONE IDD
---------- ----------
1.00 a
2.00
3.00
4.00 b
5.00 SQL>
where x.a=y.a(+);