SQL> select a.a,b.b from test a left join (select * from test where a in(select min(a) from test group by b)) b on a.a=b.a order by a.a;
A B
--- ----------
1 zxy
2
3
4 zxz
5 zxb
SQL> select * from test;
A B
--- ----------
1 zxy
2 zxy
3 zxy
4 zxz
5 zxb
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-669395/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-669395/