declare @a table(a int,b int, c int)
insert into @a
select 1, 1 , 2 union
select 2, 1 , 3 union
select 3, 2 , 4 union
select 4, 2 , 5 select * from @a t
where exists
(select 1 from @a where b=t.b and c>t.c)--结果
--a b c
--1 1 2
--3 2 4
insert into @a
select 1, 1 , 2 union
select 2, 1 , 3 union
select 3, 2 , 4 union
select 4, 2 , 5 select * from @a t
where exists
(select 1 from @a where b=t.b and c>t.c)--结果
--a b c
--1 1 2
--3 2 4
解决方案 »
- sql中时间字段需要加单引号吗??
- his接口数据连接问题?
- 我从SQL server select 出来的数据怎么快速导入ACCESS
- select into 问题
- 请教SQLServer2000数据库中有没有保存自增标识当前值的地方
- 求解:win7 (windows 7)下SQL Server管理器无法连接到远程SQL数据库
- SQL查询的问题
- 在存储过程中这样写变量相加是否正确????
- 用存储过程分页,可以只返回一个记录集么?
- 如何让sql server 自动管理日志大小
- sql脚本在批处理文件中执行需要怎么做?不打开查询分析器
- 使用vb 和sqlserver的数据库的朋友们来帮忙啦,sqlsever中text字段的问题?
group by b
group by b