Afonso_DiazGrouping users
    Updated 2025-02-03
    with

    t as (
    select
    tx_hash,
    block_timestamp,
    tx_receiver as user
    from near.core.fact_transactions
    join near.core.dim_address_labels
    on address = tx_signer
    where project_name = 'sweat'
    and label_type = 'games'
    and tx_succeeded = 1

    union all

    select
    tx_hash,
    block_timestamp,
    tx_signer as user
    from near.core.fact_transactions
    join near.core.dim_address_labels
    on address = tx_receiver
    where project_name = 'sweat'
    and label_type = 'games'
    and tx_succeeded = 1
    ),

    t3 as (
    select
    user,
    count(distinct tx_hash) as transactions,
    min(block_timestamp) as first_transaction_at
    from t
    where block_timestamp >= '2024-01-01'
    group by 1
    QueryRunArchived: QueryRun has been archived