Query editor
with eth_price as (SELECTdate_trunc('minute',minute) as minute,AVG(price) as priceFROM prices.usdWHERE minute > DATE('2023-11-01')GROUP BY 1),nfts as (SELECTrow_number() OVER (PARTITION BY blockchain ORDER BY block_time DESC) as ranking,tx_hash,blockchain,block_timeFROMnft.transfersWHERE"from" = 0x0000000000000000000000000000000000000000and block_time > DATE('2023-11-01')AND block_time < date_trunc('day', now())AND blockchain in ('base','optimism','ethereum','zora')GROUP BY tx_hash,blockchain,block_time)SELECTt.blockchain,SUM(((CAST(gas_used as double) * CAST(gas_price as double)) + COALESCE(l1_fee,0)) / 1e18 * price) AS all_tx_feeFROM evms.transactions tLEFT JOIN eth_price ON minute = date_trunc('minute',block_time)INNER JOIN nfts n on hash = tx_hash and t.blockchain = n.blockchainWHERE ranking <= 1000000GROUP BY 1