mlhnear gas 4
    Updated 2022-07-23
    with contracts_fee as
    (SELECT BLOCK_TIMESTAMP as date, TX_RECEIVER, TRANSACTION_FEE/1e24 as fee, TX_HASH
    FROM near.core.fact_transactions
    )

    select
    (select sum(fee) as total_fee
    from contracts_fee) as total_fee,

    (select count(*) as total_txs
    from contracts_fee) as total_txs,

    (select sum(fee) as total_fee
    from contracts_fee
    where date_trunc('month',date)>=date_trunc('month',current_date)) as month_fee,

    (select count(*) as total_txs
    from contracts_fee
    where date_trunc('month',date)>=date_trunc('month',current_date)) as month_txs,

    (select sum(fee) as total_fee
    from contracts_fee
    where date_trunc('week',date)>=date_trunc('week',current_date)) as week_fee,

    (select count(*) as total_txs
    from contracts_fee
    where date_trunc('week',date)>=date_trunc('week',current_date)) as week_txs
    Run a query to Download Data