ZSaed7. token
    Updated 2022-06-09
    with nfts as (select *
    from flipside_prod_db.algorand.asset
    where creator_address = 'GOOSECHXVEKJ4SO43NTW5HXOIGLFGC2SQDAVWQGJCN576ODJ5SECV6MUOM'
    and ASSET_DELETED = FALSE )
    , holders as (select a.*
    from flipside_prod_db.algorand.account_asset a
    INNER JOIN (select ASSET_ID,max(ASSET_ADDED_AT) as ASSET_ADDED_AT
    from flipside_prod_db.algorand.account_asset
    where ASSET_ID in (select asset_id from nfts )
    and AMOUNT = 1 GROUP by ASSET_ID ) b
    on (a.ASSET_ID= b.ASSET_ID and a.ASSET_ADDED_AT =b.ASSET_ADDED_AT)
    where
    -- ASSET_LAST_REMOVED is NULL and -- there are some asset like 582662337 that are not on any wallet if we set this assumption
    AMOUNT = 1
    -- AND ASSET_CLOSED = FALSE
    -- AND FROZEN = FALSE
    and a.ASSET_ID in (select asset_id from nfts )
    )
    , coin as (
    select
    *
    from flipside_prod_db.algorand.account_asset
    where ASSET_ID = 751294723
    and AMOUNT>0
    and ASSET_LAST_REMOVED is NULL )
    , nft as (
    select address , count(asset_id) as hold_nm from holders GROUP by address
    )
    -- select address , amount ,
    -- row_number() over (order by amount DESC) as token_rank,
    -- holders.
    -- from coin left JOIN holders on coin.address = holders.address


    select a.ADDRESS , iff(hold_nm is null , 0 ,hold_nm) as hold_num, iff(a.AMOUNT is null , 0 ,a.AMOUNT) as balance ,
    Run a query to Download Data