Mrfti2024-01-28 01:59 PM
    Updated 2024-04-18
    WITH tbl AS (
    SELECT tx_from AS address
    , SUM(-amount) AS net_amount
    FROM solana.core.fact_transfers
    WHERE mint = 'WENWENvqqNya429ubCdR81ZmD69brwQaaBYY6p3LCpk'
    GROUP BY 1
    UNION
    SELECT tx_to AS address
    , SUM(amount) AS net_amount
    FROM solana.core.fact_transfers
    WHERE mint = 'WENWENvqqNya429ubCdR81ZmD69brwQaaBYY6p3LCpk'
    GROUP BY 1
    ), tbl2 AS (
    SELECT address
    , SUM(net_amount) AS net_amount
    FROM tbl
    GROUP BY 1
    ), tbl3 AS (
    SELECT address
    , net_amount
    FROM tbl2
    WHERE net_amount >= 1
    )
    SELECT
    COUNT( DISTINCT address) AS "Total $WEN holders"
    , MEDIAN(net_amount) AS "Median amount held",
    avg (net_amount) AS "Average amount held"
    FROM tbl3

    QueryRunArchived: QueryRun has been archived