• Write two queries. SQL Server doesn't really support code reuse in a useful way. If you have two different sets of requirements, write two different queries.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning