with miners as (select
miner,
sum(tx_count) as txs
from ethereum.core.fact_blocks
group by 1
having txs > 1000000)
select
case
when tx_count < 100 then 'Under 100'
when tx_count >= 100 and tx_count < 200 then '100 to 200'
when tx_count >= 200 then 'Over 200'
end as tag,
count(distinct block_number) as blocks
from ethereum.core.fact_blocks
where miner in (select miner from miners)
group by 1