Query editor
WITHlatest_licenseAlias_text_table AS (SELECTtokenId,-- prefer the new text column when non‐empty, otherwise decode the binaryCOALESCE(NULLIF(licenseAlias_text, ''),FROM_UTF8(FROM_HEX(SUBSTRING(TRY_CAST(licenseAlias_binary AS VARCHAR),3)))) AS licenseAlias_text,evt_block_numberFROM (SELECTtokenId,licenseAlias_binary,licenseAlias_text,evt_block_number,ROW_NUMBER() OVER (PARTITION BY tokenIdORDER BY evt_block_number DESC) AS rnFROMdevlicensedimo_v2_polygon.devlicensedimo_v2_evt_LicenseAliasSetWHERElicenseAlias_text IS NOT NULLOR licenseAlias_binary IS NOT NULL) subWHEREsub.rn = 1),latest_output_clone_table AS (SELECTtokenId,output_clone_FROM (SELECTtokenId,output_clone_,ROW_NUMBER() OVER (PARTITION BY tokenIdORDER BY call_block_time DESC) AS rnFROMdimo_license_account_factory_polygon.LicenseAccountFactory_call_createWHEREoutput_clone_ IS NOT NULL) subWHEREsub.rn = 1),vehicles_shared_with_count_table AS (SELECT