Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Help joining tables (no duplicates)

Posted on by 3,015

I need help writing a SQL join that does not produce duplicates. I need to combine these three tables. Your help will be greatly appreciated seeing as I can use your example as a future reference of learning.

View: AccountTransactions

View: customers

View: ReceivablesTransactions

I am using report builder 2.0. GP 2010.

*This post is locked for comments

  • Verified answer
    Mahmoud Saadi Profile Picture
    Mahmoud Saadi 32,738 on at
    RE: Help joining tables (no duplicates)

    Referring to Ms. Victoria's Blog, there is a script for all receivable transactions with associated definition for all the fields. Each transaction will have at least two of the following distribution types depending on the transaction type and associated parameters

    RM Distribution Types;

    • Cash
    • Terms Taken
    • Accounts Receivable
    • Writeoffs
    • Terms Available
    • GST
    • PPS
    • Other
    • Sales
    • Trade
    • Frieght
    • Miscellaneous
    • Taxes
    • COGS
    • Inventory
    • Finance Charges
    • Returns
    • Debit Memo
    • Credit Memo
    • Service
    • Warranty Expense
    • Warranty Sales
    • Commissions Expense
    • Commissions Payable
    • Unit Account
    • Rounding
    • Realized Gain
    • Realized Loss
    • Unrealized Gain
    • Unrealized Loss

    SQL view with all GL distributions for AR transactions

    I do believe that you need to get all Receivable transactions details for a specific distribution type (Account Receivable). To add a filter to the script above;

    SELECT * FROM 

    (

    SCRIPT

    ) AS RCVTRX

    WHERE RCVTRX.Distribution_Type = 'Accounts Receivable'

    Just to note that joining more than one distribution record for the receivable document will result with duplicating the header details as previously illustrated in another post of yours;

    Add debit and credit from RM10101

    Hope this helps, 

  • Suggested answer
    Richard Whaley Profile Picture
    Richard Whaley 25,195 on at
    RE: Help joining tables (no duplicates)

    What type of Account Transactions?  GL transactions?  and do you want to sort by customer or transaction?

    here is one script keying off of the customer:

    SELECT DISTINCT * FROM RM00101 C LEFT OUTER JOIN RM20101 T ON C.CUSTNUM=T.CUSTNUM

    If by account transactions you mean the GL transactions for the receivable, then do another Left Outer Join  on the RM distributions table, joining on the transaction IDs.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans