查询语句
A列 B列
1 1
1 2
1 3
2 1
2 2
3 3
3 4我想查询出以A,B列分组后对应的B列所有值大于2的A列值,即结果只有是3的查询语句
A列 B列
1 1
1 2
1 3
2 1
2 2
3 3
3 4我想查询出以A,B列分组后对应的B列所有值大于2的A列值,即结果只有是3的查询语句
解决方案 »
- 现在想做一个批量删除,涉及到一些sql语句,不知道如何合并这些sql语句
- 用T-SQL判断2000至2100年间那些是闰年?
- 接上一问题,这样的SQL怎么写?
- 访问非本地数据库的地址格式是什么???
- 我的Sqlserver 安装步骤 请大家看看 有没有不对的地方
- 请问Sql Server 2000的最新补丁是SP3a吗?
- 各位大侠,请问如何将 数据库 数据 放进javascript 里面的数组,求求你们帮帮小弟,已经有几个晚上都没有睡好觉了!!
- SQL语句这是什么意思 tempdb..sysobjects
- sql 中如何取得数字中的整数位和小数位?
- 除了oracle,db2, sql server, sysbase, informix之外还有那些数据库支持ado?
- 求字符串截取转换方法
- SQL批量添加记录的存储过程!谢谢!
select distinct a列 from tb where b列>2有多列也同上面一样 你只查a列
go
create table [tb]([A] int,[B] int)
insert [tb]
select 1,1 union all
select 1,2 union all
select 1,3 union all
select 2,1 union all
select 2,2 union all
select 3,3 union all
select 3,4
goselect * from tb t
where not exists(select 1 from tb where a=t.a and b<=2)/**
A B
----------- -----------
3 3
3 4(2 行受影响)
**/
where not exists(select 1 from tb where a=t.a and b<=2)
请教兄台
select 1 from tb where a=t.a and b<=2是什么意思
select 1 from tb where a=t.a and b<=2 表tb中符合a=t.a and b<=2的记录--select 1 from tb的意思你可以在查询分析器执行下看看