with flowpricee as (
select TIMESTAMP::date as date, avg(price_usd) as flowprice
from flow.core.fact_prices
where symbol ='FLOW' and source ='coinmarketcap'
group by 1)
select nft_id,
count (distinct tx_id) as Sales_Count,
sum (case when currency ='A.ead892083b3e2c6c.FlowUtilityToken' then price*flowprice else price end) as Total_Sale_Volume
from flow.core.ez_nft_sales t1 join flowpricee t2 on t1.block_timestamp::date = t2.date
where nft_collection = 'A.e4cf4bdc1751c65d.AllDay'
and tx_succeeded = 'TRUE'
group by 1
order by 2 DESC
limit 10