select a.* from guest a where exists(select 1 from guest where Age=a.Age and ID!=A.ID)
解决方案 »
- 这个update怎么弄
- 【请教ROY,FC,大叔等】如何修改SQL2005/2008实例名
- SQL Server 2008 R2 和SQL Server 2008的区别?
- where col like '08%' 和 where col like '08888%' 哪个效率高些?
- 简单问题:
- 有关CASE的一段语句,报语法错,进来帮我看看。
- 求助:关于一个从数据库取出数据后在表格里循环显示的问题!
- 请教,在创建视图时,语句“with check option”有什么作用??
- vfp数据库如何与sql server 2000数据库实现时时转换?急于寻求答案
- 怎么样把一个数据库里的内容复制到另一个数据库,要求表之间的关系正确?
- 要死了阿!!大哥大姐们快来帮忙啊!!
- 请教一个收藏页面的数据库设计
id int identity,
Age int,
Tel int
)
insert into Guest values(20,null)
insert into Guest values(30,null)
insert into Guest values(20,null)
insert into Guest values(25,0)
insert into Guest values(19,null)
insert into Guest values(25,null)
insert into Guest values(35,null)select * from Guest
where Age in(
select Age from Guest
group by Age
having count(1)>1
)
id int identity,
Age int,
Tel int
)
insert into Guest values(20,null)
insert into Guest values(30,null)
insert into Guest values(20,null)
insert into Guest values(25,0)
insert into Guest values(19,null)
insert into Guest values(25,null)
insert into Guest values(35,null)select * from Guest
where Age in(
select Age from Guest
group by Age
having count(1)>1
)---
id Age Tel
----------- ----------- -----------
1 20 NULL
3 20 NULL
4 25 0
6 25 NULL(所影响的行数为 4 行)
------------------------------------------------------------------
elect
a.*
from
guest a
where
a.Age in(select Age from guest group by Age having count(*)>1)
Age in(select Age from Guest group by Age having count(1)>1)