select count(*), case
when date < '2022-04-27' then 'used wallet'
when date >= '2022-04-27' then 'new wallet' end as status from(
select m."address", n.date from(
select distinct(PURCHASER) as "address"
from solana.core.fact_nft_mints
where PROGRAM_ID = '7ai9NePVdjZ2aPcMju7KQkXEryVQPxzZgMAhBieeZ1h'
and SUCCEEDED = 'TRUE') as m
left join(
select min(block_timestamp) as date, SIGNERS[0] as address
from solana.core.fact_transactions
group by 2) as n
on m."address" = n.address)
group by 2