with tab1 as (select
origin_to_address,
count(tx_hash) AS number_of_transfer
FROM gnosis.core.ez_xdai_transfers
where block_timestamp >= current_date-30
group by origin_to_address order by number_of_transfer desc
limit 10)
select
date_trunc('day',block_timestamp) as date,
x.origin_to_address,
count(tx_hash) AS number_of_transfer
FROM gnosis.core.ez_xdai_transfers x
join tab1 t on t.origin_to_address = x.origin_to_address
where block_timestamp >= current_date-30
and x.origin_to_address in (select origin_to_address from tab1)
group by date ,x.origin_to_address order by number_of_transfer desc