Query editor
WITH target_token AS (SELECT 'EqquikmAsy62SHadHzHnVXWusLRnWtP2vgseAthdpump' AS token_mint_address),token_trades AS (SELECTt.trader_id,t.token_bought_mint_address,t.token_sold_mint_address,t.amount_usd AS amount_usd -- Corrected column name from amount_sol to amount_usdFROM dex_solana.trades tJOIN target_token ttON t.token_bought_mint_address = tt.token_mint_addressOR t.token_sold_mint_address = tt.token_mint_addressWHERE t.amount_usd > 1 -- Corrected column name from amount_sol to amount_usd),buy_amounts AS (SELECTROUND(amount_usd, 6) AS amount_usd, -- Corrected column name from amount_sol to amount_usdCOUNT(*) AS transaction_countFROM token_tradesWHERE token_bought_mint_address = (SELECT token_mint_address FROM target_token)GROUP BY ROUND(amount_usd, 6) -- Corrected column name from amount_sol to amount_usd),sell_amounts AS (SELECTROUND(amount_usd, 6) AS amount_usd, -- Corrected column name from amount_sol to amount_usdCOUNT(*) AS transaction_countFROM token_tradesWHERE token_sold_mint_address = (SELECT token_mint_address FROM target_token)GROUP BY ROUND(amount_usd, 6) -- Corrected column name from amount_sol to amount_usd)SELECT'buy' AS transaction_type,amount_usd,transaction_countFROM buy_amountsUNION ALLSELECT'sell' AS transaction_type,amount_usd,transaction_countFROM sell_amountsORDER BY transaction_type, amount_usd;