• There are multiple ways you could do this:

    1. CTE like the suggestion above.

    2. Outer Apply function

    3. Using an correlated subselect with an reference to the left table in your where clause.

    4. In 2012 you could use the rows unbounded preceding function.

    The method you would use all depends on your data layer / index usage. The outer apply function could be really handy for SQL 2008 but should be only used when the date columns + columns in the where clause are indexed (same for the subselect).