with final_result as (
select count(buyer_address) as eligible_addresses
from (select buyer_address, min(date) as mint_date
from (select date(block_timestamp) as date,
BUYER_ADDRESS, sales.tx_hash, data_one.tx_hash as count_of_transactions,
price_usd
from ethereum.core.ez_nft_sales sales inner join (select tx_hash
from
ethereum.core.fact_transactions
where to_address = '0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b') data_one
on data_one.tx_hash = sales.tx_hash)
where PRICE_USD>0 and date<'2022-12-14'
group by 1
-- order by 2 asc
)
)
select * from final_result