Shown below are the SQL FROM statements from a VIEW I have created to show all transactions. I need to add the PO Number and Requisition number associated with the transactions.
Can someone show me the appropriate JOIN ON statements to connect to POP30310 to get the PONUMBER field and to POP10100 to get the CONFIRM1 field?
I have been able to link the tables but am getting duplicate records. I am not providing the appropriate JOIN statements and don't know which fields should be used for the JOIN. If someone could show me the appropriate JOIN statements I would be very grateful. If there is any documents showing which fields should be used to join various tables I would also be very greatful.
Thanks,
Lee
---------------------------------------------------------------------------- SQL statements follow ---------------------------------------
SELECT ....
FROM GL10001 AS [Unposted Trans](NOLOCK)
INNERJOIN GL10000 AS [GL Work] (NOLOCK)ON [GL Work].jrnentry = [Unposted Trans].jrnentry
INNERJOIN GL00105 AS IndexMSTR (NOLOCK)ON [Unposted Trans].ACTINDX = IndexMSTR.ACTINDX
INNERJOIN GL00100 AS AccountMSTR (NOLOCK)ON IndexMSTR.ACTINDX = AccountMSTR.ACTINDX
INNERJOIN GL00102 AS CategoryMSTR (NOLOCK)ON AccountMSTR.ACCATNUM = CategoryMSTR.ACCATNUM
UNION
SELECT ....
FROM GL20000 AS [Open Trans] (NOLOCK)
INNERJOIN GL00105 AS IndexMSTR (NOLOCK) ON [Open Trans].ACTINDX = IndexMSTR.ACTINDX
INNERJOIN GL00100 AS AccountMSTR (NOLOCK) ON IndexMSTR.ACTINDX = AccountMSTR.ACTINDX
INNERJOIN GL00102 AS CategoryMSTR (NOLOCK) ON AccountMSTR.ACCATNUM = CategoryMSTR.ACCATNUM
UNION
SELECT ....
FROM GL30000 AS [History Trans] (NOLOCK)
INNERJOIN GL00105 AS IndexMSTR (NOLOCK)ON [History Trans].ACTINDX = IndexMSTR.ACTINDX
INNERJOIN GL00100 AS AccountMSTR (NOLOCK)ON IndexMSTR.ACTINDX = AccountMSTR.ACTINDX
INNERJOIN GL00102 AS CategoryMSTR (NOLOCK)ON AccountMSTR.ACCATNUM = CategoryMSTR.ACCATNUM