删除一张表的重复数据----(备忘)

1 delete from zlTable2
2 where businessid in
3 (select businessid from zlTable2 group by businessid having count(businessid)>1)
4 and idp not in
  (select min(idp) from zlTable2 group by businessid having count(businessid)>1 )

 

注释:删除zlTable2里面的重复字段businessid的数据,只保留一条idp(自增字段)最小的记录

posted @ 2010-07-27 09:48  旧事重播__、  阅读(320)  评论(4编辑  收藏  举报