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.*//* !Bytea parameter warning: Make sure to change \x to 0x in the parameters, bytea types are native now (no need for quotes or lower or \x)' */WITHwrapper AS (WITHswap_aggs AS (WITHpersonal_swaps AS (SELECTCOUNT(DISTINCT tx_hash) FILTER (WHERE tx_from = {{Wallet Address}}) AS swapsFROMdex.tradesWHERE(blockchain = 'ethereum'and tx_to = 0x881d40237659c251811cec9c364ef91dc08d300c)OR(blockchain = 'polygon'and tx_to = 0x1a1ec25DC08e98e5E93F1104B5e5cdD298707d31)),other_swaps AS (SELECTtx_from AS wallet,COUNT(DISTINCT tx_hash) AS swapsFROMdex.tradesWHERE(blockchain = 'ethereum'and tx_to = 0x881d40237659c251811cec9c364ef91dc08d300c)OR(blockchain = 'polygon'and tx_to = 0x1a1ec25DC08e98e5E93F1104B5e5cdD298707d31)GROUP BYtx_from)SELECTCOUNT(DISTINCT other_swaps.wallet) FILTER (WHEREother_swaps.swaps > personal_swaps.swaps) AS more_swaps,COUNT(DISTINCT other_swaps.wallet) FILTER (WHEREother_swaps.swaps < personal_swaps.swaps) AS less_swaps,COUNT(DISTINCT other_swaps.wallet) FILTER (WHEREother_swaps.swaps = personal_swaps.swaps) AS same_swapsFROMother_swapsLEFT JOIN personal_swaps ON 1 = 1)SELECT'Fewer' AS label,