SELECT GL.JRNENTRY, dbo.SY03900.NOTEINDX AS APNoteIndx, dbo.SY03900.TXTFIELD AS APNote, PM.VENDORID, dbo.PM00200.VENDNAME, PM.DOCTYPE, PM.DOCDATE,
PM.DOCNUMBR, PM.DOCAMNT, PM.CURTRXAM, PM.DUEDATE, PM.BACHNUMB, PM.VOIDED, PM.VCHRNMBR
FROM (SELECT VCHRNMBR, VENDORID, DOCTYPE, DOCDATE, DOCNUMBR, DOCAMNT, CURTRXAM, DISTKNAM, DISCAMNT, DSCDLRAM, BACHNUMB, TRXSORCE,
BCHSOURC, DISCDATE, DUEDATE, PORDNMBR, TEN99AMNT, WROFAMNT, DISAMTAV, TRXDSCRN, UN1099AM, BKTPURAM, BKTFRTAM, BKTMSCAM,
VOIDED, HOLD, CHEKBKID, DINVPDOF, PPSAMDED, PPSTAXRT, PGRAMSBJ, GSTDSAMT, POSTEDDT, PTDUSRID, MODIFDT, MDFUSRID, PYENTTYP,
CARDNAME, PRCHAMNT, TRDISAMT, MSCCHAMT, FRTAMNT, TAXAMNT, TTLPYMTS, CURNCYID, PYMTRMID, SHIPMTHD, TAXSCHID, PCHSCHID,
FRTSCHID, MSCSCHID, PSTGDATE, DISAVTKN, CNTRLTYP, NOTEINDX, PRCTDISC, RETNAGAM, ICTRX, Tax_Date, PRCHDATE, CORRCTN, SIMPLIFD,
BNKRCAMT, APLYWITH, Electronic, ECTRX, DocPrinted, TaxInvReqd, VNDCHKNM, BackoutTradeDisc, CBVAT, VADCDTRO, TEN99TYPE,
TEN99BOXNUMBER, PONUMBER, DEX_ROW_TS, DEX_ROW_ID
FROM dbo.PM20000
UNION
SELECT VCHRNMBR, VENDORID, DOCTYPE, DOCDATE, DOCNUMBR, DOCAMNT, CURTRXAM, DISTKNAM, DISCAMNT, DSCDLRAM, BACHNUMB, TRXSORCE,
BCHSOURC, DISCDATE, DUEDATE, PORDNMBR, TEN99AMNT, WROFAMNT, DISAMTAV, TRXDSCRN, UN1099AM, BKTPURAM, BKTFRTAM, BKTMSCAM,
VOIDED, HOLD, CHEKBKID, DINVPDOF, PPSAMDED, PPSTAXRT, PGRAMSBJ, GSTDSAMT, POSTEDDT, PTDUSRID, MODIFDT, MDFUSRID, PYENTTYP,
CARDNAME, PRCHAMNT, TRDISAMT, MSCCHAMT, FRTAMNT, TAXAMNT, TTLPYMTS, CURNCYID, PYMTRMID, SHIPMTHD, TAXSCHID, PCHSCHID,
FRTSCHID, MSCSCHID, PSTGDATE, DISAVTKN, CNTRLTYP, NOTEINDX, PRCTDISC, RETNAGAM, VOIDPDATE, ICTRX, Tax_Date, PRCHDATE, CORRCTN,
SIMPLIFD, APLYWITH, Electronic, ECTRX, DocPrinted, TaxInvReqd, VNDCHKNM, BackoutTradeDisc, CBVAT, VADCDTRO, TEN99TYPE, TEN99BOXNUMBER,
PONUMBER, DEX_ROW_TS, DEX_ROW_ID
FROM dbo.PM30200) AS PM INNER JOIN
dbo.PM00200 ON PM.VENDORID = dbo.PM00200.VENDORID INNER JOIN
(SELECT JRNENTRY, NOTEINDX, ORCTRNUM
FROM dbo.GL20000
UNION
SELECT JRNENTRY, NOTEINDX, ORCTRNUM
FROM dbo.GL30000) AS GL ON PM.VCHRNMBR = GL.ORCTRNUM LEFT OUTER JOIN
dbo.SY03900 ON PM.NOTEINDX = dbo.SY03900.NOTEINDX
No comments:
Post a Comment