select
count( address),
sum(balance) as total_balance
from
terra.daily_balances
where
date = '2022-01-23'
and currency = 'LUNA'
and balance > 0
and balance_type = 'liquid'
and (
ADDRESS_LABEL is NULL
or ADDRESS_LABEL != 'terraform'
)
and (
ADDRESS_NAME is NULL
or ADDRESS_NAME != 'terra mint/burns swap fees'
)
and (
ADDRESS_LABEL_SUBTYPE is NULL
or ADDRESS_LABEL_SUBTYPE != 'staking'
)
-- group by balance_type