Posted on 2015-03-12 13:53
朱杰兵 阅读(88)
评论(0) 编辑 收藏
两张关联表,删除主表中已经在副表中没有的信息
delete
from
table1
where
not
exists (
select
*
from
table2
where
table1.field1=table2.field1 )
删除重复记录
delete
from
tablename
where
id
not
in
(
select
max
(id)
from
tablename
group
by
col1,col2,...)