Query editor
WITHavg_eth_usd_price AS (SELECTAVG(price) AS price,DATE_TRUNC('hour', minute) AS hour_timeFROMprices.usd_latestWHEREsymbol = 'ETH'GROUP BY2),usd_revenue_from_registration AS (SELECTSUM(ROUND(TRY_CAST(cost * avg_eth_usd_price.price AS DECIMAL),2)) / CAST(POWER(10, 18) AS DOUBLE) AS revenue,DATE_TRUNC('month', evt_block_time) AS monthFROMethereumnameservice.view_registrations AS nrLEFT JOIN avg_eth_usd_price /* <-- have no idea about joins, so not sure is it right or not */ ON avg_eth_usd_price.hour_time = DATE_TRUNC('hour', nr.evt_block_time)GROUP BY2),usd_revenue_from_renewals AS (SELECTSUM(ROUND(TRY_CAST(cost * avg_eth_usd_price.price AS DECIMAL),2)) / CAST(POWER(10, 18) AS DOUBLE) AS revenue,DATE_TRUNC('month', evt_block_time) AS monthFROMethereumnameservice.view_renewals AS nrLEFT JOIN avg_eth_usd_price /* <-- have no idea about joins, so not sure is it right or not */ ON avg_eth_usd_price.hour_time = DATE_TRUNC('hour', nr.evt_block_time)GROUP BY2)SELECTusd_revenue_from_registration.revenue + usd_revenue_from_renewals.revenue AS total_revenue,usd_revenue_from_renewals.month AS monthFROMusd_revenue_from_registrationLEFT JOIN usd_revenue_from_renewals ON usd_revenue_from_registration.month = usd_revenue_from_renewals.monthWHEREusd_revenue_from_renewals.month >= CURRENT_TIMESTAMP - INTERVAL '1' year