• vsarade (9/18/2012)


    When executing the query with adding the FULL JOIN with where clause like below -

    SELECT Professor.Id AS [Professor.Id], Professor.ProfessorName,

    CASE Professor.HasTenure WHEN 1 THEN 'True' WHEN 0 THEN 'False' ELSE NULL END AS [Has Tenure],

    Class.ProfessorId AS [Class.ProfessorId], Class.ClassName,

    Class.ClassYear, Class.ClassSemester

    FROM Professor

    FULL JOIN Class

    ON Professor.Id = Class.ProfessorId AND Class.ClassYear >= 2011

    WHERE Professor.HasTenure = 'True'

    Then it is giving same results as adding LEFT OUTER JOIN.

    Not really surprising. This is for the same reason that putting the "Class.ClassYear = 2011" condition into the where clause eliminates the effect of the LEFT OUTER JOIN and makes it act like an INNER JOIN. Because the condition "Professor.HasTenure = 'True'" is in the WHERE clause it will eliminate all of the entries where HasTenure is NULL. In other words it is eliminating all of the entries that the difference between FULL and OUTER join caused.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]