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语句啊?

解决方案 »

  1.   

    delete a43
    where id in 
    (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')
    ----------------------------------------------------------------------
    没有进行测试
    应该没有问题
      

  2.   

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

  3.   

    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來試試看
      

  4.   

    忘了说明A43表没有ID这类单一主键。但是a0100 a4300和flag三个字段组合后可以唯一确定一条记录。
      

  5.   


    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'
      

  6.   

    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 m.flag = 'bbb'