binhachonCopy of 18. [Easy] Wealth distribution - Base table
    Updated 2021-11-07
    with wealth_distribution as(
    select address, sum(amount) as balance from (
    select from_address as address, -rune_amount as amount from thorchain.transfers
    union all
    select to_address as address, rune_amount as amount from thorchain.transfers
    )
    group by address
    )
    select '1' as symbol, percentile_cont(0.2) within group (order by balance),
    percentile_cont(0.4) within group (order by balance),
    percentile_cont(0.6) within group (order by balance),
    percentile_cont(0.8) within group (order by balance)
    from wealth_distribution
    where balance > 0
    group by symbol


    Run a query to Download Data