SQL:找出数据表某个字段中重复的值并显示
上一篇 /
下一篇 2011-03-09 09:53:52
/ 个人分类:SQL
【第一次写于 2010-05-05 16:34:53 网易blog:http://blog.163.com/chaosumin@126/blog】
例子:
create table Student
(StudentID char(10),
Name char(10))
找出出现两次以上的名字
select Name
from Student
group by Name
having count (distinct StudentID) >= 2
相关阅读:
- SQL Server专家的十个秘密 (xin_晴, 2011-1-17)
- 详解DBA如何安排SQL Server数据库自动监控 (xin_晴, 2011-1-21)
- 如何编写安全的SQL数据库代码? (xin_晴, 2011-2-15)
- 数据库查询优化原则 (系统消息, 2011-2-21)
- SQL Server资源管理之内存管理篇(上) (xin_晴, 2011-2-28)
- SQL Server资源管理之内存管理篇(下) (xin_晴, 2011-3-01)
- 数据库备份与还原 (peggyli, 2011-3-02)
- 保护SQL Server数据库的十大绝招 (xin_晴, 2011-3-04)
- 查看SQL语句执行耗费的时间 (gzhuangwei, 2011-3-09)
- SQL Server 2005 重装时报:对性能监视器计数器注册表值执行系统配置检查失败 (转载) (gzhuangwei, 2011-3-09)
收藏
举报
TAG:
SQL
查询