• kimberly_lehman (6/6/2014)


    Ok, well in question 1, it looks to me like all 4 would return the same result, but I didn't test it! Putting a predicate on the ON clause should be the same as putting it in the where clause with an inner join. And the outer join shouldn't change anything because there aren't any non-matching rows.

    1 1 1 21

    1 2 1 21

    The last query is different.

    You only take one row of table B (since customValue = 21), but you match it against every row of table A.

    The third row doesn't match (A.ID <> B.ID), so the columns from B are NULL

    3rd row: 2 1 NULL NULL.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP