• rhydian (1/20/2014)


    Surely the following is an easier way to accomplish this...

    SELECT PR.id, PR.ProfessorName, ClassName, ClassYear, ClassSemester

    FROM Professor PR

    LEFT JOIN

    (

    SELECT ProfessorID, ClassName, ClassYear, ClassSemester

    FROM Class

    WHERE ClassYear>=2011

    ) SQ ON SQ.ProfessorID = PR.Id

    WHERE PR.HasTenure = 1

    It is equivalent (probably even for performance) to the proposed solution, but 2 SELECTs add visual clutter, IMO: you are repeating the list of fields 2 times. And, in complex queries, you could be tempted to use *, God forbid 😉

    For many people, your solution could probably be easier to understand, which has value.

    I would prefer to work with people that understands (and writes) the proposed solution, instead of this one.