Re: SQL question ...
Posted in 1996
Irwin Goldstein — — source: Informix-list mailing list archive (1991-1998)
CSC CIS <spal@watson.den.csci.csc.com> wrote in article
<52s67m$k1q@cssun.mathcs.emory.edu>...
> Lee
>
> How about
> DELETE FROM A WHERE
> C1 IN (SELECT C1 FROM B WHERE XXX)
> AND C2 IN (SELECT C2 FROM B WHERE XXX);>
> Sujit Pal
> DBA, Computer Sciences Corp.
>
This may delete too much! You could have two SEPARATE rows in B, one which
macthes C1 (but not C2) and one which matches C2 (but not C1). This is the
way to do it:
delete A
where exists (select *
from B
where B.C1 = A.C1 and B.C2 = A.C2)