with maintable as (
select block_timestamp::Date as date,
case when date < '2023-02-13' then 'Before BUSD-PAX Issues'
else 'After BUSD-PAX Issues' end as timespan,
count (Distinct tx_hash) as TX_Count,
count (distinct payer) as Users_Count,
sum (repayed_tokens) as Total_Volume,
avg (repayed_tokens) as Average_Volume
from ethereum.aave.ez_repayments
where block_timestamp >= '2023-02-01'
and symbol = 'BUSD'
group by 1,2)
select timespan,
avg (tx_count) as Average_TX_Count,
avg (users_count) as Average_Users_Count,
avg (total_volume) as Average_Volume
from maintable
group by 1