sql---应用

1、表中多条记录中A字段、B字段有重复的,以ID为key,做数据清理,A、B字段重复的只保留一条:

delete from table1 where ID is not in ( select min(ID) as ID from table1 group by A,B )

其中:select min(ID) as ID from table1 group by A,B: 筛选出根据A、B分组后最小的ID集合

 

 

posted @ 2013-10-31 11:40  nygfcn  阅读(112)  评论(0编辑  收藏  举报