with bins as (
select
floor(amount/10.00)*10 as bin_floor,
count(receiver) as count
from (
select receiver,
amount
from algorand.payment_transaction
where block_timestamp::date > '2022-03-30'
and try_base64_decode_string(tx_message:txn:note::string) like '%af/gov1:j{"rewardsPrd":2%'
and amount <1000
)
group by 1
order by 1
)
select
bin_floor,
bin_floor || ' - ' || (bin_floor + 10) as bin_range,
count
from bins
order by 1