create or replace view "tv_nupnam" as
 SELECT pc."VpNr" AS "PartnerVPNR",
        pc."PartnerName" AS "PartnerPartnerName",
        alignuencnames(pc."PartnerName", pc."PartnerName") AS "NormPartnerPartnerName",
        pcqse."FileUploadId" AS "QsUploadId",
        urec."VP Name" AS "UploadPartnerName",
        alignuencnames(pc."PartnerName", urec."VP Name") AS "NormUploadPartnerName"
   FROM "Partner" pc
     LEFT JOIN "QsEintrag" pcqse ON pcqse."VpNr"::text = pc."VpNr"{{double_colons}}text
       LEFT JOIN "CCTEMPUENCFURECS" urec ON urec."UPLOADID" = pcqse."FileUploadId"{{double_colons}}numeric AND urec."VPNR"{{double_colons}}text = pcqse."VpNr"::text
       LEFT JOIN "FileUpload" fu ON fu."Id" = pcqse."FileUploadId"
 WHERE pc."PartnerName"{{double_colons}}text ~~ concat('%', chr(65533), '%') AND pcqse."FileUploadId" IS NOT NULL
 GROUP BY pc."VpNr", pcqse."FileUploadId", urec."VP Name"
 ORDER BY pc."VpNr"