请教一个查询语句 select * from [table] a where not exists(select 1 from [table] where A=a.a and b=a.b and c>a.c) and B=2 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select A,B,MAX(C)AS C FROM TABLE1 WHERE B=2 GROUP BY A,B declare @t table(A int, B int, C int, D int, E int , F int) insert @t select 1 , 1 , 1 ,null,null,null insert @t select 1 , 2 , 3 ,null,null,null insert @t select 1 , 3 , 4 ,null,null,null insert @t select 2 , 2 , 2 ,null,null,null insert @t select 2 , 2 , 3 ,null,null,null insert @t select 2 , 2 , 4 ,null,null,null select * from (select * from @t where B=2) t where not exists(select * from(select * from @t where B=2) s where s.a=t.a and s.c>t.c )/*A B C D E F ----------- ----------- ----------- ----------- ----------- ----------- 1 2 3 NULL NULL NULL2 2 4 NULL NULL NULL*/ select a,max(b) as b,max(c) as c,max(d) as d,max(e) as e,max(f) as f from 表名where b=2group by a count(id) 查询没有办法用inner join吗? 多表同时跟一张表主键关联的问题 求转换问题 求教:系统升级数据库平移到另一台机器上要 怎么做? sql server 合并重复的相邻记录 SQL 用 游标 怎么实现这个问题???? returns 返回字段数限制,不能超过255 sqlserver2000 数据迁移,40万数据,从就数据库批量select insert 到新数据库,花了16分钟?感觉时间有点长,怎么解决? "%"与“*”的区别 如何检测SQL数据库是否已有连接? 求教一条查询语句(有点复杂) 怎样在SQL2000加入表描述
insert @t select 1 , 1 , 1 ,null,null,null
insert @t select 1 , 2 , 3 ,null,null,null
insert @t select 1 , 3 , 4 ,null,null,null
insert @t select 2 , 2 , 2 ,null,null,null
insert @t select 2 , 2 , 3 ,null,null,null
insert @t select 2 , 2 , 4 ,null,null,null
select * from (select * from @t where B=2) t where not exists(select * from(select * from @t where B=2) s where s.a=t.a and s.c>t.c )
/*
A B C D E F
----------- ----------- ----------- ----------- ----------- -----------
1 2 3 NULL NULL NULL
2 2 4 NULL NULL NULL*/
where b=2
group by a