if object_id('t') is not null
drop table t
go
create table t(C_No varchar(20),C_Area varchar(50),i_Value int)
insert t select'123456', 'wh', 20
union all select'123456', 'cs', 40
union all select'123456', 'gz', 60
union all select'111111', 'gz', 100
union all select'222222', 'wh', 60
union all select'222222', 'gz', 20
union all select'123456', 'cs', 80
go
select * from t
go
select C_Area,sum(i_Value) C_Area,count(C_No) icount from t t1 where i_Value >
(select min(i_Value) from t where c_Area = t1.c_Area) group by C_Area order by c_Area
C_Area C_Area icount
-------------------------------------------------- ----------- -----------
cs 80 1
gz 160 2
wh 60 1
(3 行受影响)