Yousefi_1994Top pool id after unstake in the last 6 month
    Updated 2022-07-19
    with first_undelegate as (
    select
    delegator_address as wallet,
    min(block_timestamp) as first_undelegate_time,
    avg(amount) as undelegate_amount
    from osmosis.core.fact_staking
    where tx_status = 'SUCCEEDED'
    and action = 'undelegate'
    and block_timestamp >= current_date - 180
    group by wallet
    order by first_undelegate_time
    ),
    first_swap as (
    select
    trader as wallet,
    min(block_timestamp) as first_swap_time,
    avg(from_amount) as swap_amount
    from osmosis.core.fact_swaps
    where tx_status = 'SUCCEEDED'
    and from_currency = 'uosmo'
    and block_timestamp >= current_date - 180
    group by wallet
    order by first_swap_time
    ),
    first_pool_join as (
    select
    liquidity_provider_address as wallet,
    min(block_timestamp) as first_pool_join_time,
    avg(amount/1e6) as pool_join_amount
    from osmosis.core.fact_liquidity_provider_actions
    where tx_status = 'SUCCEEDED'
    and currency = 'uosmo'
    and action = 'pool_joined'
    and block_timestamp >= current_date - 90
    group by wallet
    order by first_pool_join_time
    Run a query to Download Data