with data as (
select
date(created_at) as date,
sum(if(app_promoting_co = 'Reby' and owner_co != 'Reby',1,0)) as hey,
count(*) as all_
from `reby-cloud.analytics_reby_v1_eu.transactions_combined_reassigned_final`
where type like 'ride%'
and date(created_at) > current_date - 50
and service_area = 'Barcelona'
group by 1
--order by 1 desc
)
select hey / all_ from data order by 1 desc