Posted on 2015-03-12 13:53
朱杰兵 閱讀(90)
評論(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,...)