有2个表
表first
id number,
a number,
b number,
c number表second
aa number,
bb number,
cc number现在我想删除表first中的数据,条件是a=aa and b=bb and c=cc,只有同时满足这3条才删除这个可执行的sql语句怎么写?最后是放在oracle存储过程中执行的
表first
id number,
a number,
b number,
c number表second
aa number,
bb number,
cc number现在我想删除表first中的数据,条件是a=aa and b=bb and c=cc,只有同时满足这3条才删除这个可执行的sql语句怎么写?最后是放在oracle存储过程中执行的
where exists(
select 1
from second y
where x.a = y.aa
and x.b = y.bb
and x.c = y.cc
and rownum = 1 --加上rownum =1是为了效率,这样效率可能高,也可会降低
);
delete from first a
where exists (select 1 from second b where a.a=b.aa and a.b=b.bb and c.c=c.cc);