SELECT
date_trunc('day',block_timestamp) as block_day,
nft_marketplace,
case
when nft_marketplace = 'rand gallery' then 'Rand Gallery'
when nft_marketplace = 'algoxnft' then 'Algoxnft'
else 'Others' end as marketplace,
count(distinct(purchaser)),
sum(total_sales_amount),
sum(number_of_nfts)
from
algorand.nft_sales
where
block_day >= CURRENT_DATE - 7
group by block_day,nft_marketplace
order by block_day