Query editor
/* Migration success :)There are some cases such as unnest/sequence and array/json functions the migrator won't take care of for you(but we have examples of in the docs linked below!)If you're still running into issues, check out the doc examples https://dune.com/docs/reference/dune-v2/query-engine/or reach out to us in the Dune discord in the #dune-sql channel.*/WITHswap_counts AS (SELECTtx_from AS wallet,blockchain,COUNT(DISTINCT tx_hash) AS swapsFROMdex.tradesWHERE(blockchain = 'ethereum'AND tx_to = 0x881d40237659c251811cec9c364ef91dc08d300c)OR(blockchain = 'polygon'and tx_to = 0x1a1ec25DC08e98e5E93F1104B5e5cdD298707d31)GROUP BYtx_from, blockchain)SELECTblockchain,COUNT(wallet) AS wallets,CASEWHEN swaps < 6 THEN '1-5'WHEN swaps < 11 THEN '6-10'WHEN swaps < 26 THEN '11-25'WHEN swaps < 100 THEN '26-99'WHEN swaps >= 100 THEN '100+'END AS swap_bucket,CASEWHEN swaps < 6 THEN 1WHEN swaps < 11 THEN 2WHEN swaps < 26 THEN 3WHEN swaps < 100 THEN 4WHEN swaps > 100 THEN 5END AS bucket_orderFROMswap_countsGROUP BY 1,3,4ORDER BY 4