Query editor
WITH current_transfers AS (SELECT transfer_primary_key, messages_foreign_keyFROM (SELECTprimary_key AS transfer_primary_key,messages_foreign_key,_updated_at,ROW_NUMBER() OVER (PARTITION BY primary_keyORDER BY _updated_at DESC NULLS LAST, messages_foreign_key DESC) AS rnFROM layerzero.transfersWHERE messages_foreign_key IS NOT NULLAND type_transfer != 'nativedrop'AND token IS NOT NULLAND usd_value > 0)WHERE rn = 1), joined AS (SELECTCASE m.layerzero_versionWHEN 'V1' THEN '1'WHEN 'V2' THEN 'v2'ELSE LOWER(m.layerzero_version)END AS bridge_version,LOWER(m.source_chain_key) AS deposit_chain,LOWER(m.destination_chain_key) AS withdrawal_chain,t.transfer_primary_key,m.primary_key AS message_primary_key,m.tx_hash_source,m.tx_hash_destination,m.ts_source,m.ts_destination,m.addr_from,m.source_contract,m.destination_contract,m.state,m._updated_at AS message_updated_atFROM layerzero.messages mINNER JOIN current_transfers tON m.primary_key = t.messages_foreign_keyWHERE m.state = 'Success'AND (m.ts_source IS NOT NULL OR m.ts_destination IS NOT NULL)AND COALESCE(LOWER(m.source_chain_key), '') NOT IN ('goerli', 'sepolia', 'sepolia-testnet')AND COALESCE(LOWER(m.destination_chain_key), '') NOT IN ('goerli', 'sepolia', 'sepolia-testnet')), duplicate_keys AS (SELECT bridge_version, deposit_chain, withdrawal_chain, transfer_primary_keyFROM joinedGROUP BY 1, 2, 3, 4HAVING COUNT(*) > 1)SELECTj.bridge_version,j.deposit_chain,j.withdrawal_chain,j.transfer_primary_key,j.message_primary_key,j.tx_hash_source,j.tx_hash_destination,j.ts_source,