首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求sql语句,对于删除时需要多表复合条件连接的怎么办

2012-01-15 
求sql语句,对于删除时需要多表复合条件连接的怎么处理?select语句如下selecta43.*froma43joina01ona43.a01

求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 '

热点排行