select date_trunc('day', latest_time) as block_time, count (owners) as no_of_newcomers
from
(
select min(block_timestamp) as latest_time, (event_inputs:owner::string) as owners
/*case when latest_time=CURRENT_DATE then 'today'
when latest_time >current_date-7 and latest_time != current_date then 'this week'
else 'old' end as date_purchased */
from polygon.events_emitted
where contract_address=lower('0xdC0479CC5BbA033B3e7De9F178607150B3AbCe1f') --crypto_unicorns nft contract
group by 2
order by 1 desc
)
group by 1
order by 1 desc