All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
两台Sql,server数据同步_[SQL,Server教程]
Excel在.Net下驻留内存的解决方法_[Asp.Net教程]
PHP入门:动态网页制作技术PHP的变量类型_[PHP教程]
C#中的PrintDocument组件的属性的应用实例
ASP.NET常用代码Eval,DataBinder.Eval实例_[Asp.Net教程]
Asp.Net发送电子邮件程序_[Asp.Net教程]
Windows,Server,2003,出现的Service,Unavailable的一个解决方法_[Asp.Net教程]
基础知识:PHP连接mysql测试和配置_php资料_编程技术
在PHP动态网页开发过程中实现支持页面回跳的方法_php资料_编程技术
ASP.NET移动开发之SelectionList控件_[Asp.Net教程]
Reading number is top 10 pictures
清纯性感的美眉2
采访谢楠
A man's favorite things6
The real super beauty9
非常漂亮的泳装美女
英雄联盟超神十连杀截图
2015中美最新武器装备巅峰对决!
Go to the national museum2
超级大兔子
Female model behind the bitterness, often being overcharged3
Download software ranking
Proficient in Eclipse
linux初级教程
双旗镇刀客B
变速齿轮3.26
Twenty piece of palm leaf
Desire a peach blossom
matrix3
实战黑客不求人
Proficient in JavaScript
天龙八部最新服务端
归海一刀 published in(发表于) 2014/2/3 6:46:26 Edit(编辑)
查询数据库中重复记录的方法_[SQL Server教程]

查询数据库中重复记录的方法_[SQL Server教程]

查询数据库中重复记录的方法_[SQL Server教程]
1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断
select * from people
where peopleId in (select peopleId from people group by peopleId having count

(peopleId) > 1)

2、删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录
delete from people
where peopleId in (select peopleId from people group by peopleId having count

(peopleId) > 1)
and rowid not in (select min(rowid) from people group by peopleId having count(peopleId

)>1)

3、查找表中多余的重复记录(多个字段)
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having

count(*) > 1)

4、删除表中多余的重复记录(多个字段),只留有rowid最小的记录
delete from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having

count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)

5、查找表中多余的重复记录(多个字段),不包含rowid最小的记录
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having

count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)




添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.