fat3meh2023-06-08 01:22 PM
    SELECT
    COUNT(*) AS dim_num_holders
    FROM (
    SELECT
    ledger.account
    , SUM(ledger.amount) / POWER(10, 18)
    FROM (
    SELECT
    FROM_ADDRESS AS account
    , CAST(RAW_AMOUNT as DECIMAL) * -1 as amount
    FROM ethereum.core.fact_token_transfers
    WHERE LOWER(contract_address) = LOWER('0xb3999F658C0391d94A37f7FF328F3feC942BcADC')
    UNION ALL
    SELECT
    FROM_ADDRESS AS account
    , CAST(RAW_AMOUNT as DECIMAL) * -1 as amount
    FROM ethereum.core.fact_token_transfers
    WHERE LOWER(contract_address) = LOWER('0x44Ec807ce2F4a6F2737A92e985f318d035883e47')
    UNION ALL
    SELECT
    TO_ADDRESS AS account
    , CAST(RAW_AMOUNT as DECIMAL) as amount
    FROM ethereum.core.fact_token_transfers
    WHERE LOWER(contract_address) = LOWER('0xb3999F658C0391d94A37f7FF328F3feC942BcADC')
    UNION ALL
    SELECT
    TO_ADDRESS AS account
    , CAST(RAW_AMOUNT AS DECIMAL) as amount
    FROM ethereum.core.fact_token_transfers
    WHERE LOWER(contract_address) = LOWER('0x44Ec807ce2F4a6F2737A92e985f318d035883e47')
    Run a query to Download Data