Query editor
withusd_table as (select symbol,price from prices.usd_latestwhere symbol = 'ETH' order by minute desc limit 1),eth_price as (SELECTDATE_TRUNC('hour', block_time) AS hour,ROUND(AVG((cast(gas_price as decimal) * cast(gas_used as decimal) * (select price from usd_table)) / 1e18), 2) AS avg_gas_price FROM ethereum.transactionsWHERE DATE_TRUNC('hour', block_time) >= (NOW() - INTERVAL '1' DAY)GROUP BY 1 ORDER BY hour),arb_price as (selectDATE_TRUNC('hour', block_time) AS hour,ROUND(AVG((cast(gas_price as decimal)/1e18 + (cast(gas_used as decimal) * cast(effective_gas_price as decimal))/1e18) * (select price from usd_table)), 2) AS avg_gas_price FROM arbitrum.transactionsWHERE DATE_TRUNC('hour', block_time) >= (NOW() - INTERVAL '1' DAY)GROUP BY1ORDER BYhour),opt_price as (selectDATE_TRUNC('hour', block_time) AS hour,ROUND(AVG(((cast(gas_price as decimal) * cast(gas_used as decimal)) + l1_fee) * (select price from usd_table) / 1e18), 2) AS avg_gas_priceFROMoptimism.transactionsWHEREDATE_TRUNC('hour', block_time) >= (NOW() - INTERVAL '1' DAY)GROUP BY1ORDER BYhour)selecta.hour as Hour,e.avg_gas_price as ethereum_gas_usd,a.avg_gas_price as arb_gas_usd,o.avg_gas_price as optimism_gas_usdfrometh_price e,arb_price a,opt_price owherea.hour = e.hourand a.hour = o.hourorder by1;