如何查询出重复记录?

easyfly 2004-11-09 09:15:48
如何在一张表中查询出重复的记录呢?
就是表中有两条或两条以上记录相同,其他记录不相同,查询出有重复的记录。
...全文
159 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
davorsuker39 2004-11-09
  • 打赏
  • 举报
回复
select a,b,c,....
from table
group by a,b,c,....
having count(*)>1
ORARichard 2004-11-09
  • 打赏
  • 举报
回复
select * from table group by * having count(0)>1

把*换成表中的所有字段
yuncai 2004-11-09
  • 打赏
  • 举报
回复
select * from table a where (select count(*) from table b where a.xx=b.xx)>1
WangZWang 2004-11-09
  • 打赏
  • 举报
回复
select col1,col2,col3....
from table
group by col1,col2,col3....
having count(*)>1

pbsql 2004-11-09
  • 打赏
  • 举报
回复
select col1,col2,col3... from t group by col1,col2,col3... having count(*)>1
easyfly 2004-11-09
  • 打赏
  • 举报
回复
Thanks!

34,588

社区成员

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

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