Query editor
WITHeth_prices as (SELECTdate_trunc('day', minute) as price_time,AVG(price) as eth_priceFROMprices.usdWHEREsymbol = 'ETH'GROUP BY1),friend_tech_time AS (SELECT1 AS key_join,MIN(DATE_TRUNC('day', evt_block_time)) AS min_friendFROMfriendtech_base.FriendtechSharesV1_evt_Trade),friend AS (SELECT'Friend Tech' AS category,DATE_TRUNC('day', evt_block_time) AS date_time,COUNT(DISTINCT evt_tx_hash) AS total_tx,COUNT(DISTINCT trader) AS number_of_buyers,SUM(ethAmount / 1e18) AS volume,SUM(ethAmount / 1e18 * eth_price) as volume_usd,SUM(ethAmount / 1e18 * 0.05) AS mod_volume,SUM(ethAmount / 1e18 * eth_price * 0.05) as mod_volume_usdFROMfriendtech_base.FriendtechSharesV1_evt_TradeLEFT JOIN eth_prices ON DATE_TRUNC('day', evt_block_time) = price_timeGROUP BY1,2),friend2 AS (SELECT'Friend Tech' AS category,DATE_TRUNC('day', evt_block_time) AS date_time,COUNT(DISTINCT evt_tx_hash) AS total_buy_tx,SUM(ethAmount / 1e18) AS inflow,SUM(ethAmount / 1e18 * eth_price) as inflow_usdFROMfriendtech_base.FriendtechSharesV1_evt_TradeLEFT JOIN eth_prices ON DATE_TRUNC('day', evt_block_time) = price_timewhere isBuy = trueGROUP BY1,2)SELECT*FROMfriendLEFT JOIN friend_tech_time ON 1 = key_joinLEFT JOIN friend2 ON friend.date_time = friend2.date_timeWHEREfriend.date_time >= min_friendand friend.category = 'Friend Tech'