with table1 as (with tab1 as (select from_address as user_, min(block_timestamp::date) as First_Tx_date
from gnosis.core.fact_transactions
where block_timestamp::date>='2022-01-01'
group by 1
order by 1)
select user_
from tab1
where First_Tx_date='2022-10-05'),
table2 as (select from_address, count(distinct tx_hash) as tx_count, to_address
from gnosis.core.fact_transactions
where block_timestamp::date='2022-10-05'
group by 1,3)
select sum(tx_count) as "Tx Count", to_address
from table1 left join table2 on table1.user_=table2.from_address
group by 2
order by 1 desc
limit 1