ML6delegeate and undelegate frequency
    Updated 2022-07-16
    with delegate as (select delegator_address ,to_date(block_timestamp) as delegate_date
    from osmosis.core.fact_staking
    where action ilike 'delegate')
    , undelegate as (select delegator_address as undelegate_address,to_date(block_timestamp) as undelegate_date
    from osmosis.core.fact_staking
    where action ilike 'undelegate')
    , redelegate as (select delegator_address as redelegate_address,to_date(block_timestamp) as redelegate_date
    from osmosis.core.fact_staking
    where action ilike 'redelegate')
    select count(*) , datediff('day',delegate_date,undelegate_date) from delegate inner join undelegate
    on delegator_address=undelegate_address and undelegate_date >= delegate_date
    group by 2
    Run a query to Download Data