0xtableauTWC_Current_Holders
    Updated 2022-11-28
    with current_holder as (
    with transfer_table as (
    select
    block_timestamp
    ,tx_id
    ,event_name
    ,event_inputs
    ,event_inputs:from::string as "from_address"
    ,event_inputs:to::string as "to_address"
    ,event_inputs:tokenId::integer as "tokenID"
    from ethereum.events_emitted
    where lower(contract_address) = lower('0x85f740958906b317de6ed79663012859067E745B')
    and event_name = 'Transfer'
    order by 7 asc, 1 desc)

    select *,
    row_number() over (PARTITION BY "tokenID" ORDER BY block_timestamp desc) as row_num
    from transfer_table
    order by 1 desc)

    select
    "to_address" as wallet,
    block_timestamp as rec_dt,
    "tokenID" as token_id
    from current_holder where row_num=1
    Run a query to Download Data