--这样?
declare @t table(proj_id int,res_id int,task_id int,starttime varchar(10),availability int)
insert into @t select 1,101,1,'2006-4-30',30
union all select 1,101,1,'2006-5-1',100
union all select 1,101,1,'2006-5-2',90
union all select 1,101,2,'2006-4-30',50
union all select 1,101,2,'2006-5-1',50
union all select 1,101,3,'2006-4-30',40
union all select 1,101,3,'2006-5-1',20
union all select 1,101,3,'2006-5-2',60
union all select 2,101,4,'2006-4-30',20
union all select 2,101,4,'2006-5-1',20
union all select 2,101,5,'2006-5-2',10select res_id,starttime,sum(availability) as availability  from @t group by res_id,starttime