select address, count(address) as number_of_deposit, sum(deposits) as deposit_amount from (
select msg_value:from_address::string as address, msg_value:amount[0]:amount / 1e6 as deposits
from terra.msgs
where msg_value:to_address = 'terra1dax9mddsycvzkc429wwy494vhzhggw3d5594rt'
and block_timestamp < '2021-11-10T02:00:00Z'
and tx_status = 'SUCCEEDED'
)
group by address
order by deposit_amount desc