with tab1 as (
select BLOCK_TIMESTAMP::date as date
,count(distinct TX_ID) as "Tx Count"
,sum(FEE) as "Fee Amount"
from terra.core.fact_transactions
where TX_SUCCEEDED='TRUE'
and date>='2023-01-07' and date <='2023-01-20'
group by 1),
tab2 as (
select BLOCK_TIMESTAMP::date as date
,sum(AMOUNT) as "Restake Volume"
from terra.core.ez_staking
where TX_SUCCEEDED='TRUE'
and date>='2023-01-07' and date <='2023-01-20'
and ACTION='Redelegate'
group by 1)
select tab2.date,"Tx Count","Fee Amount","Restake Volume"
from tab1
left join tab2
on tab1.date=tab2.date