--1.查出data2 是100或者是20的数据,同时要求如果data2是100 的话那么data1必须是20select * from t where (t.data2=100 and t.data1=20) or (t.data2=20);--2.如果不支持WM_CONCAT,那就选择递归查询select t1.c1 from (select c1,rownum c2 from t) t1 start with t1.c2=1 connect by prior t1.c2 = t1.c2 - 1
select LISTAGG(a, ', ') WITHIN GROUP (ORDER BY a) from table
from 表 a where not exists (select 1 from 表 b where data2=100 and data1<>20
and a.data1=b.data1)
select * from t where (t.data2=100 and t.data1=20) or (t.data2=20);