delete from Table1 
where (id,positionid)in (select (id,positionid) from Table1 a 
left join Table2 b on 
a.positionid=b.positionid where ID ='03CS391' and b.NeverUpdateBOM='N')我要删除table1里的某些资料,但是对于table1的资料还要进行筛选。
执行时会出现“接近 ',' 之處的語法不正確。”的错误提醒。
请问应该如何写??
急!!

解决方案 »

  1.   

    where (ltrim(id)+','+ltrim(positionid))in (select ltrim(id)+','+ltrim(positionid) from ... 
      

  2.   

    delete from Table1 where id in (select id from Table1 a left join Table2 b on  
    a.positionid=b.positionid where ID ='03CS391' and b.NeverUpdateBOM='N') and
    positionid in (select positionid from Table1 a left join Table2 b on  
    a.positionid=b.positionid where ID ='03CS391' and b.NeverUpdateBOM='N')
      

  3.   


      
       delete from Table1  where exists 
       select 1 from (
       select a.id,a.positionid from Table1 a left join Table2 b on 
       a.positionid=b.positionid where ID ='03CS391' and b.NeverUpdateBOM='N'
       )a where id=a.id  and positionid=a.positionid