Results 1 to 4 of 4

Thread: Sql Joins

  1. #1
    Join Date
    Oct 2003
    Posts
    73

    Unanswered: Sql Joins

    Alright,
    I've done lots of joins and I understand them. But my understanding gets into the gray area when I see something like this:

    ...
    FROM tblDIV
    RIGHT OUTER JOIN tblSG ON tblDIV.DIVID = tblSG.DIVID
    LEFT OUTER JOIN tblDM ON tblSG.DIVID = tblDM.DIVID
    LEFT OUTER JOIN tblDAC ON tblSG.DIVID = tblDAC.DIVID
    RIGHT OUTER JOIN tblC INNER JOIN tblO ON tblC.CUSTID = tblO.CUSTID
    INNER JOIN tblOS ON tblO.ORDERID = tblOS.ORDERID

    above is a join within a join "RIGHT OUTER JOIN tblC INNER JOIN tblO ON tblC.CUSTID = tblO.CUSTID"

    I don't understand how this works. If someone can give me a run through, that would be great.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Think of it as a "nested join".

    Basically you have your main dataset that you want to RIGHT OUTER JOIN to the dataset produced by tblC INNER JOIN tblO ON tblC.CUSTID = tblO.CUSTID

    Whereas tblC is referenced in both the right AND inner joins, and the right join is natural (it has no criteria), I would say that this statement is actually malformed.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Oct 2003
    Posts
    73
    thx for the reply Teddy,
    it kind of clarifies it for me. I'll try to find another example of multiple inner joins.

  4. #4
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557

    Explanation?

    I have heard about using SQL to make joins, but I dont know how it works or anything. I understand why you are making the join (like using the relationships layout to set it up).

    I would just like a basic explanation of the different join types and why would I want to use them over say the relationships layout.

    Thanks,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •