maybeyonasflipside_dup_query
    Updated 2022-07-20
    with
    gas_stat as (
    select
    from_address,
    'eth' as chain,
    sum(tx_fee) as total_fees,
    sum(gas_used) as total_gas,
    median(tx_fee) as median_fee,
    avg(tx_fee) as average_fee,
    max(tx_fee) as max_fee,
    count(tx_hash) as txs,
    count(
    case when origin_function_signature = '0x' then '0x' else null end
    ) as eth_sends,
    min(block_timestamp) as first_date
    from ethereum.core.fact_transactions
    group by 1,2
    union all
    select
    from_address,
    'poly' as chain,
    sum(tx_fee) as total_fees,
    sum(gas_used) as total_gas,
    median(tx_fee) as median_fee,
    avg(tx_fee) as average_fee,
    max(tx_fee) as max_fee,
    count(tx_hash) as txs,
    count(
    case when origin_function_signature = '0x' then '0x' else null end
    ) as eth_sends,
    min(block_timestamp) as first_date
    from polygon.core.fact_transactions
    group by 1,2
    Run a query to Download Data