朱杰兵blog

jonhney'blog
posts - 140, comments - 1, trackbacks - 0, articles - 0

sql

Posted on 2015-03-12 13:53 朱杰兵 阅读(87) 评论(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,...)


只有注册用户登录后才能发表评论。


网站导航: