使用别名,将该表看成是两张表, select first.A from t1 first ,t1 second where first.A=substr(second.a,0,1) or first.A = substr(second.a,2,1) or first.A = substr(second.a,4,1)
SQL> select regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) from dual 2 connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null; REGEXP_SUBSTR('SMITH,A ---------------------- SMITH ALLEN WARD JONES
感谢crazy_samba的回答 本人对于connect by 不是很熟悉 那么我是想用表中的一个字段去in 那么该如何写呢?
select first.A from t1 first ,t1 second where first.A=substr(second.a,0,1) or first.A = substr(second.a,2,1) or first.A = substr(second.a,4,1)
2 connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null;
REGEXP_SUBSTR('SMITH,A
----------------------
SMITH
ALLEN
WARD
JONES
感谢crazy_samba的回答 本人对于connect by 不是很熟悉
那么我是想用表中的一个字段去in 那么该如何写呢?