select
date_trunc('day',block_timestamp) as blook_day,
date_trunc('hour',block_timestamp) as blook_hour,
case
when delegator_address = 'terra1kpufnf2x4lh9z8rh7sesd8r7g8lnuqhsln4d2j' then 'me'
else 'everyone else' end as delegator,
count(*) as transactions,
sum(event_amount_usd) as amount
from terra.staking
where
validator_address_name = 'terravaloper1r843mpk5zzkfgtnduskd0dzgeltv0n503ckzy6'
-- and date_trunc('day',block_timestamp) > CURRENT_DATE - 14
and date_trunc('day',block_timestamp) = '2022-01-26 00:00:00.000'
group by 1, 2, 3
order by 4 desc