怎么删除一张表中某一字段的重复记录,

wuqing9018 2011-12-27 03:53:15
f1,f2,f3,f4字段
选出f1中相同的数据,只要f1字段数据相同就删除此行(包括f2 f3 f4 字段)。
...全文
49 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
delete from tb where f1 in(select f1 from tb group by f1 having count(*)>1)
用count(*)>1判断是否有重复
pengxuan 2011-12-27
  • 打赏
  • 举报
回复

delete a from tb a where (select count(1) from tb where f1=a.f1)>1
-晴天 2011-12-27
  • 打赏
  • 举报
回复

delete from tb where f1 in(select f1 from tb group by f1 having count(*)>1)

34,873

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧