with tx_ids as ( select tx_id from algorand.payment_transaction
where block_timestamp::date >= '2022-01-01'
and amount is not NULL
and amount >0
group by 1
)
select block_timestamp::date as date ,
case when amount BETWEEN 0 and 10 then '0-10'
when amount BETWEEN 10 and 100 then '10-100'
when amount BETWEEN 100 and 1000 then '100-1000'
when amount BETWEEN 1000 and 10000 then '1000-10000'
else '10000+'
end as amount ,
count (DISTINCT tx_id) as transactions
from algorand.payment_transaction
where tx_id in (select * from tx_ids )
group by 1 ,2