Jika polanya sama, Anda dapat melakukan sesuatu seperti
select
substring_index(string,'::',1) as string_val,
sum(number) as number
from mytable
group by string_val
Jika polanya sama, Anda dapat melakukan sesuatu seperti
select
substring_index(string,'::',1) as string_val,
sum(number) as number
from mytable
group by string_val