Topic: Simple request
The help with such request is necessary:
There are 2 tables t1 c one field and t2 with two fields. In all three fields unique identifiers of one sequence lie.
It is required from 1 to eliminate tables any of each pair of lines found in single line t2.
with t1 as (select 1 ID from dual union all select 2 from dual union all select 3 from dual union all select 6 from dual); t2 as (select 2 ID, 3 Pair from dual union all select 3, 2 from dual union all select 5, 6 from dual union all select 6, 5 from dual)
To receive 1, 2 and 6 or 1, 3 and 6 as in t2 there was a line 2,3 - is necessary any of them to eliminate.
My attempts while stopped on
select * from t1 where not exists (select 0 from t2 where greatest (t2.id, t2.pair) = t1.id)
But it is wrong, since I receive 1 and 2 (without 6)