MLDZMNloft4
    Updated 2022-07-14
    with tbt as (SELECT
    address as wl
    FROM algorand.account_asset
    WHERE asset_id IN (SELECT asset_id FROM algorand.asset
    WHERE creator_address = 'LOFTYRITC3QUX6TVQBGT3BARKWAZDEB2TTJWYQMH6YITKNH7IOMWRLC7SA')
    AND asset_name != 'Lofty AI'
    AND asset_closed = 'FALSE'
    group by 1),

    tb1 as (select *
    from algorand.asset
    where TOTAL_SUPPLY=1 and DECIMALS=0
    )

    SELECT
    'NFT holder' as type,
    count(distinct ADDRESS) as number_own
    from flipside_prod_db.algorand.account_asset
    where ASSET_ID in (select ASSET_ID from tb1)
    and ADDRESS in (select wl from tbt)
    union all
    SELECT
    'Not hold NFT' as type,
    count(distinct ADDRESS) as number_own
    from flipside_prod_db.algorand.account_asset
    where ASSET_ID not in (select ASSET_ID from tb1)
    and ADDRESS in (select wl from tbt)


    Run a query to Download Data