Toad World® Forums

I do not want the insertion

select f1, f2, f3
from cr r inner join cp p
on p.id = r.id
and p.c_m = 2019

I do not want the insertion
I do not want the inner join
how can I get only the records that do not intersect?
Thank a lot!

I'm not exactly sure what you are after, maybe something like this?

select f1, f2, f3
from cr r, cp p
where not (p.id = r.id and p.c_m = 2019)

I'm not 100% sure of what you mean I'm afraid, I see no INSERT in the code you provided. However, I see that you don;t want a join, so, to get the rows that do not intesect, you have two options:

All the rows in CR that are not in CP or all the rows in CP that are not in CR - these two lists need not be the same.

select f1,f2,f3 from cr
minus
select f1,f2,f3 from cp;

or

select f1,f2,f3 from cp
minus
select f1,f2,f3 from cr;

Why are you averse to joins I wonder? :wink:

Cheers,
Norm. [TeamT]

1 Like

I'm guessing when antoine_mc1 typed "insertion" that antoine_mc1 meant "intersection".

I'm thinking you're right but seems he abandoned the thread.