with vvp as (select
address,
min(dayz) as latest_date -- takes the earliest entry of the validator in this table
from (select
address,
date(block_timestamp) as dayz
from terra.validator_voting_power
where dayz >= CURRENT_DATE - 60) -- selects entries where the record starts in the past 60 days
group by address ),
vl as (SELECT
label,
vp_address
from terra.validator_labels
)
SELECT
label,
count(vvp.address) as address
from vvp
left join vl
ON vvp.address = vl.vp_address
group by 1
order by 2 desc