Query editor
WITH Recent_Transactions AS (SELECTtaker AS address,SUM(amount_usd) AS total_amount_usdFROM aerodrome.tradesWHEREblock_date >= timestamp '2024-10-01'GROUP BYtaker),cex_label AS (SELECTaddress,name AS cex_labelFROM labels.addressesWHEREmodel_name = 'cex_ethereum'),other_label AS (SELECTaddress,ARRAY_AGG(name) AS other_labelFROM labels.addressesGROUP BYaddress),contract_address as (selectaddressfromlabels.addresseswherecategory = 'contracts'group by1)SELECTa.address,round(a.total_amount_usd,2) total_trade_usd,b.cex_label,c.other_labelFROM Recent_Transactions AS aLEFT JOIN cex_label AS bON a.address = b.addressLEFT JOIN other_label AS cON a.address = c.addressleft join contract_address as don a.address = d.addresswhered.address is nullORDER BYtotal_amount_usd DESCLIMIT 10000