1

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.
Example:
From

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)

2

Re: Simple request

It is a shame;
As idea (it is necessary  smile)))
If it is necessary  least/greatest

1 with t1 as (select 1 ID from dual union all
2 select 2 from dual union all
3 select 3 from dual union all
4 select 6 from dual);
5 t2 as (select 2 ID, 3 Pair from dual union all
6 select 3, 2 from dual union all
7 select 5, 6 from dual union all
8 select 6, 5 from dual)
9 select * from t1 where
10 not exists (select 1 from t2, t1 tt
11 where tt.id> =t1.id and (t1.id, tt.id) in ((t2.id, t2.pair)))
12* order by 1
SQL> /
ID
----------
1
3
6

.....
stax

3

Re: Simple request

Stax;
Approaches, thanks.