已回。 当然,也可以改用case when 嵌套
create table test 

a  numeric(10,3), 
b  varchar(10), 
c  varchar(10) 

insert into test values(1.1,'3','c') 
insert into test values(1.1,'3','c') 
insert into test values(1.1,'3','c') 
insert into test values(3,'3','c') 
insert into test values(4,'4','b') 
Go
select c, 'i'=isnull(nullif(convert(varchar,
sum(
case b when '3' then 
convert(int,a) 
else 0 
end
)
) ,'0'),'')
  from test 
group by c 
GODROP TABLE test
GO