rezarwzTotal number of buyers based on dapper utility coin
    Updated 2023-05-28
    with base as(
    SELECT
    TX_ID,
    BLOCK_TIMESTAMP,
    lower(SUBSTRING(marketplace, CHARINDEX('.', marketplace, CHARINDEX('.', marketplace) + 1) + 1, LEN(marketplace))) AS market_place,
    lower(SUBSTRING(NFT_COLLECTION, CHARINDEX('.', NFT_COLLECTION, CHARINDEX('.', NFT_COLLECTION) + 1) + 1, LEN(NFT_COLLECTION))) AS collection,
    NFT_ID,
    BUYER,
    SELLER,
    PRICE,
    SUBSTRING(currency, CHARINDEX('.', currency, CHARINDEX('.', currency) + 1) + 1, LEN(currency)) AS currency
    FROM flow.core.ez_nft_sales
    WHERE TX_SUCCEEDED='true')
    SELECT
    collection,
    count(DISTINCT BUYER) as number_of_buyers
    from base
    WHERE currency='DapperUtilityCoin' and collection=lower('{{collection}}')
    GROUP BY 1