Query editor
WITH degen AS (SELECT tx_from, sum(amount_usd) as Total_amount_DEGEN_BoughtFROM dex.tradesWHERE blockchain = 'base'AND token_bought_address = 0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed -- DEGENGROUP BY 1ORDER BY 2),pepe AS (SELECT tx_from , sum(amount_usd) as Total_amount_PEPE_BoughtFROM dex.tradesWHERE token_bought_address = 0x6982508145454ce325ddbe47a25d4ec3d2311933 -- PEPEgroup by 1order by 2),shib AS (SELECT tx_from , sum(amount_usd) as Total_amount_SHIB_BoughtFROM dex.tradesWHERE token_bought_address = 0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE -- SHIBgroup by 1order by 2),total as (select degen.tx_from as Address ,Total_amount_DEGEN_Bought , Total_amount_PEPE_Bought , Total_amount_SHIB_Boughtfrom degenleft join pepe on pepe.tx_from = degen.tx_fromleft join shib on shib.tx_from = degen.tx_from)select CONCAT('<a href="https://debank.com/profile/',CAST(Address as varchar), '" target="_blank" >' , CAST(Address as varchar), '</a>') as Address, Total_amount_DEGEN_Bought , Total_amount_PEPE_Bought ,Total_amount_SHIB_Bought , ( Total_amount_DEGEN_Bought + Total_amount_PEPE_Bought + Total_amount_SHIB_Bought ) as TOTL_Boughtfrom totalorder by Total_amount_DEGEN_Bought desclimit 50