bertaMoonbirds Crossovers_number of BAYC
    Updated 2022-05-09
    with BAYC_sum as ((select
    event_inputs:to as holder, 'receive' as type_of_user,
    event_inputs:tokenId as token_id
    from ethereum_core.fact_event_logs
    where contract_address = '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d' and TX_STATUS = 'SUCCESS') union all
    (select
    event_inputs:from as holder,
    'send' as type_of_user,
    event_inputs:tokenId as token_id
    from ethereum_core.fact_event_logs
    where contract_address = '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d' and TX_STATUS = 'SUCCESS')),
    BAYC_fix as (select sum(case when type_of_user = 'send' then -1
    when type_of_user != 'send' then 1
    else 0 end) as number_of_BAYC, holder
    from BAYC_sum
    group by 2)
    select holder, number_of_BAYC
    from BAYC_fix where number_of_BAYC >0
    Run a query to Download Data