3,494
社区成员




OPER@TL>select * from test;
A B
---------- ----------
a ddGT
b dd
c ccGT
c cc
c eeGT
OPER@TL>select * from test
2 where b in(select substr(b,1,instr(b,'GT')-1) from test)
3 union all
4 select * from test
5 where b not in(select nvl(substr(b,1,instr(b,'GT')-1),'X') from test)
6 and nvl(substr(b,1,instr(b,'GT')-1),'X') not in(select b from test);
A B
---------- ----------
b dd
c cc
c eeGT
OPER@TL>