WITH miners AS (
SELECT distinct miner
FROM ethereum.core.fact_blocks
where BLOCK_TIMESTAMP <='2022-09-14'
)
SELECT
sum (AMOUNT_IN) as ETH_amounts,
case
when ORIGIN_FROM_ADDRESS IN (SELECT * FROM miners) then 'miners'
else 'others'
end as type
from ethereum.core.ez_dex_swaps
where SYMBOL_IN='WETH'
and BLOCK_TIMESTAMP >='2022-06-01'
group by 2