DavidC_IL 12/15/2023 11:36:59 AM

Creating a VIEW from a SQL Query

Hello DD Family,

 

You guys did such a wonderful job with my recent request for help with a query, I thought I would press my luck and ask how to turn it into a VIEW, so that I can create an Excel Builder file...  :-)

The query is...

SELECT it.TRXSORCE, it.IVDOCTYP, it.DOCNUMBR, it.docdate, it.BCHSOURC, it.BACHNUMB, it.GLPOSTDT, it.SRCRFRNCNMBR,
        it.SOURCEINDICATOR, itd.ITEMNMBR, itd.UOFM, itd.TRXQTY,
        COALESCE(bin.bin,lotbin.frombin) combinedfields,
        itd.TRXLOCTN, bin.BIN, lotbin.SERLTNUM, lotbin.FROMBIN
    FROM iv30200 it
        JOIN iv30300 itd ON it.DOCNUMBR = itd.DOCNUMBR AND it.IVDOCTYP = itd.DOCTYPE              
        LEFT JOIN iv30302 bin ON bin.DOCNUMBR = it.DOCNUMBR AND bin.DOCTYPE = itd.DOCTYPE AND bin.LNSEQNBR = itd.LNSEQNBR
        LEFT JOIN iv30400 lotbin ON lotbin.DOCNUMBR = bin.DOCNUMBR AND lotbin.IVDOCTYP = it.IVDOCTYP AND lotbin.LNSEQNBR = bin.LNSEQNBR

 

Thanks

 

DavidC_IL

Version: All
Section: SQL for Beginners, SQL Scripts


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3