CREATE VIEW "IMCYC"."B1_JournalEntryFirstTaxIdOrBPView" ( "TransID", "LineID", "TaxID", "BPCode" ) AS SELECT T0."TransId" AS "TransID", T0."Line_ID" AS "LineID", T0."LicTradNum" AS "TaxID", T0."ShortName" AS "BPCode" FROM  "IMCYC"."JDT1" T0  WHERE T0."TransType" = ('30' )  AND  (T0."Line_ID" IN((SELECT MIN(U0."Line_ID") FROM  "IMCYC"."JDT1" U0  WHERE U0."TransId" = T0."TransId"  AND  U0."LicTradNum" IS NOT NULL   AND  U0."LicTradNum" <> ('' )  ))   OR  (T0."Line_ID" IN((SELECT MIN(U0."Line_ID") FROM  "IMCYC"."JDT1" U0  WHERE U0."TransId" = T0."TransId"  AND  U0."Account" <> U0."ShortName"  AND  (U0."LicTradNum" IS NULL   OR  U0."LicTradNum" = ('' ) ) ))   AND   NOT EXISTS (SELECT U0.*  FROM  "IMCYC"."JDT1" U0  WHERE U0."TransId" = T0."TransId"  AND  U0."LicTradNum" IS NOT NULL   AND  U0."LicTradNum" <> ('' )  ) ))