Объединить условие
Как изменить этот запрос, чтобы число не выбиралось ТОЛЬКО если есть в выборке b И в выборке c?
with a(v) as
(
select 1 from dual
union all
select 2 from dual
union all
select 3 from dual
),
b(v) as
(
select 1 from dual
union all
select 9 from dual
union all
select 5 from dual
),
c(v) as
(
select 1 from dual
union all
select 2 from dual
union all
select 5 from dual
)
select * from a
where
not exists (select 1 from b where a.v = b.v) and
not exists(select 1 from c where a.v = c.v);
Ответы (1 шт):
Автор решения: Akina
→ Ссылка
where
not (exists (select 1 from b where a.v = b.v) and
exists (select 1 from c where a.v = c.v));