sidestepping joining on multiple conditions - theoretical question

  • Access is having a hard time joining on multiple conditions. I'd like someone to confirm for me that the below, which makes sense in my head, is actually correct.

    For any instance of

    INNER JOIN ON A = 1 AND B = 2

    You can also

    INNER JOIN ON A = 1, create duplicates, and then correctly suppress those duplicates by saying

    INNER JOIN ON A = 1

    WHERE B = 2

    Thus

    INNER JOIN ON A = 1 AND B = 2

    and

    INNER JOIN ON A = 1

    WHERE B = 2

    are equivalent.

  • Correct, and this is the older syntax for joins.

    Old way:

    SELECT *

    FROM tblA AS a, tblB AS b

    WHERE

    a.Col1 = b.Col1

    Is equivalent to:

    SELECT *

    FROM tblA AS a

    JOIN

    tblB AS b

    ON a.Col1 = b.Col1

    You'll run into this more when you deal with outer joins causing confusion, thus the newer syntax.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply