Lordking789...
    Updated 2023-05-02
    with
    stake as (
    select VALIDATOR_ADDRESS,
    sum (amount) as fkow ,
    count (distinct tx_id) as flow_TRXS,
    count (distinct DELEGATOR_ADDRESS) as fow_Users
    from terra.core.ez_staking
    where tx_succeeded = 'TRUE'
    and action in ('Delegate')
    group by 1),

    unstake as (
    select VALIDATOR_ADDRESS,
    sum (amount) as Unfkow ,
    count (distinct tx_id) as unflow_TRXS,
    count (distinct DELEGATOR_ADDRESS) as unfow_Users
    from terra.core.ez_staking
    where tx_succeeded = 'TRUE'
    and action in ('Undelegate')
    group by 1)

    select
    a.VALIDATOR_ADDRESS node_id,
    fkow - Unfkow as Net_Staked ,
    flow_TRXS - unflow_TRXS as TRXS ,
    fow_Users - unfow_Users as Users
    from stake a join unstake b on a.VALIDATOR_ADDRESS = b.VALIDATOR_ADDRESS
    order by 2 DESC
    limit 10
    Run a query to Download Data