declare @t table(aa varchar(50),[count] int)
insert into @t select 'http://seek.3721.com/index.htm?',3
union all select 'http://seek.3721.com/index.htmdfdfsg',10
union all select 'http://www.baidu.com/index.htmdfddfdffsg',2
union all select 'http://www.baidu.com/index.ht',5
select left(aa,charindex('/',replace(aa,'//',''))+2) as aa,sum([count]) as 总数 from @t group by left(aa,charindex('/',replace(aa,'//',''))+2)