xjt360

delete A from Table A where exists(select count(*)c from Table B  where  A.col1=B.col1 and A.col2=B.col2 having count(*)>1)

注意 delete 后面的A必写,不然会报错 

如果用in的话便是

delete from Table A where col1+col2 in (select col1+col2 from table1 group by col1+col2 having count(*)>1)

但用in的话效率会比较低,不能用索引 

分类:

技术点:

相关文章: