Query editor
WITH stables_bought as (SELECTblock_date as time, token_sold_symbol AS token_sold, token_bought_symbol AS token_bought, SUM(amount_usd) as sum_stable_usdFROM dex.tradesWHERE token_bought_symbol IN ('USDT','BUSD','DAI','FRAX','TUSD','USDP','GUSD','USDD','USDC')AND block_time >= cast('2023-03-01 00:00:00' as timestamp)AND block_time <= cast('2023-03-18 00:00:00' as timestamp)GROUP BY 1,2,3)SELECTtime, token_bought, SUM(sum_stable_usd) as stable_bought_sumFROM stables_boughtGROUP BY 1, 2ORDER BY 3 DESC