日期:2014-05-18  浏览次数:20530 次

求sql语句,对于删除时需要多表复合条件连接的怎么处理?
select语句如下
select   a43.*
from   a43   join   a01   on   a43.a0100   =   a01.a0101   join   ldcode   on   a43.a4300   =   ldcode.codename   and   codetype   =   'aaa '
where   ldcode.comcode   >   a01.a1710   and   a43.flag   =   'bbb '  

我想把查询出来的内容删除应该如何写delete语句啊?

------解决方案--------------------
--try

delete a43
from a43
inner join a01 on a43.a0100 = a01.a0101
inner join ldcode on a43.a4300 = ldcode.codename and codetype = 'aaa '
where ldcode.comcode > a01.a1710 and a43.flag = 'bbb '
------解决方案--------------------
delete a43
where a43.rowid in
(select a43.rowid
from a43 join a01 on a43.a0100 = a01.a0101 join ldcode on a43.a4300 = ldcode.codename and codetype = 'aaa '
where ldcode.comcode > a01.a1710 and a43.flag = 'bbb ' )
先試試看,rowid如果不行就用a43.FK來試試看。。。
------解决方案--------------------

delect a43
from a43 m join a01 on m.a0100 = a01.a0101
join ldcode on m.a4300 = ldcode.codename and codetype = 'aaa '
where ldcode.comcode > a01.a1710 and a43.flag = 'bbb '