• Hello, terrance

    May you explain this syntax?

    I think it is very dangerous to transfer search condition in the WHERE clause,

    because you can alter result of "LEFT JOIN" that becomes a pure JOIN.

    FROM @WorkTable AS wt

    LEFT JOIN @CalTable AS ct ON

    wt.Work_Start <= ct.CalDate

    WHERE

    (

    CASE

    WHEN ct.CalDate <= wt.Work_End THEN 1

    ELSE 0

    END

    ) = 1