select a.* from 表 a where (select count(*) from 表 where 字段=a.字段)>1
解决方案 »
- 有条语句看不懂 希望大虾帮忙
- 请问怎么匹配这样的指令?
- 如何实现sql server数据库与oracle数据库之间双向数据同步?
- T-SQL入门攻略--T-SQL入门与提高!
- 查询不同类型的前10条记录?在线等!
- 有个得分的好办法!
- 关于for xml path拼接字符串时特殊字符的问题
- 如何判断数据库中某个表已经存在?
- sql server 2000服务管理器自动关闭
- 请看看吧:sql server存储过程中@str=abc,de,fg,h 怎样把用逗号隔开的四个字符分别提取出来,象asp的split
- 請問各位大俠:怎樣將sql的簡體數據庫(表結構及內容)轉換為繁體的?謝!
- 问句SQL怎么写,谢谢!
select 字段 from 表
group 字段
having count(*)>1
select 1,'a' union all
select 2,'b' union all
select 3,'c' union all
select 4,'a' union all
select 5,'b'select * from t where name in(
select name from t group by name having count(name)>=2)
結果:
id name
----------- ----------
1 a
2 b
4 a
5 b