Se o padrão for o mesmo, você pode fazer algo como
select
substring_index(string,'::',1) as string_val,
sum(number) as number
from mytable
group by string_val
select
substring_index(string,'::',1) as string_val,
sum(number) as number
from mytable
group by string_val