Query editor
WITH minters as (select nft_contract_address, date_trunc('day', block_time) as mint_day, buyer, token_id from nft.mintswhere nft_contract_address = 0xD0318da435DbcE0B347cc6faA330B5A9889e3585 and trade_category = 'Mint'),sold as (select distinct token_id from nft.tradeswhere nft_contract_address = 0xD0318da435DbcE0B347cc6faA330B5A9889e3585 and evt_type = 'Trade'),buyers_nft_held_from_mint as (select nft_contract_address, m.buyer, mint_day, count(case when m.token_id in (select * from sold) then 0else 1 END) as still_holding from minters mwhere m.token_id not in (select * from sold)group by 1,2,3order by still_holding desc),nft_count as (select nft_contract_address, count(distinct token_id) as total_token_count from nft.mintswhere nft_contract_address = 0xD0318da435DbcE0B347cc6faA330B5A9889e3585 and trade_category = 'Mint'group by 1),totals as (selectnft_contract_address, sum(still_holding) as held_from_mint from buyers_nft_held_from_mintgroup by 1)select t.nft_contract_address,t.held_from_mint, nft_count.total_token_count, (1.0000*t.held_from_mint)/nft_count.total_token_count * 100.00 as percentage from totals tjoin nft_count on t.nft_contract_address = nft_count.nft_contract_address