HosseinUntitled Query
    Updated 2023-01-21
    with arbitrum as (
    select
    count(distinct tx_hash) as arbitrum_txns_count,
    count(distinct from_address) as arbitrum_active_users_count,
    sum(tx_fee) as arbitrum_tx_total_fee,
    avg(tx_fee) as arbitrum_tx_avg_fee
    from arbitrum.core.fact_transactions
    where block_timestamp >= current_date - interval '6 months'
    ),

    ethereum as (
    select
    count(distinct tx_hash) as ethereum_txns_count,
    count(distinct from_address) as ethereum_active_users_count,
    sum(tx_fee) as ethereum_tx_total_fee,
    avg(tx_fee) as ethereum_tx_avg_fee
    from ethereum.core.fact_transactions
    where block_timestamp >= current_date - interval '6 months'
    ),jj

    optimism as (
    select
    count(distinct tx_hash) as optimism_txns_count,
    count(distinct from_address) as optimism_active_users_count,
    sum(tx_fee) as optimism_tx_total_fee,
    avg(tx_fee) as optimism_tx_avg_fee
    from optimism.core.fact_transactions
    where block_timestamp >= current_date - interval '6 months'
    )

    select *
    from arbitrum
    join ethereum
    join optimism