with price as (select
date_trunc('hour',hour) as daily,
avg (price) as Price ,
case when hour >= '2022-08-01' and hour < '2022-09-15' then 'Before Merge'
when daily >= '2022-09-15' then 'After Merge' else null end as Merge
from ethereum.core.fact_hourly_token_prices
where symbol = 'WETH'
and daily >= '2022-09-05' and daily <= '2022-09-24'
group by daily,Merge
order by Merge)
SELECT
avg (Price) as AVG_Price,
Min (Price) as Min_Price,
Max (Price) as Max_Price,
Merge
from price GROUP by Merge