Tune the ‘Peak Years’ Procedure – SQLChallenge (52 minutes)

Ready to tune some TSQL? Your mission, if you choose to accept it, is to tune the TSQL in a stored procedure so it can make the best use of the given indexes -- and still returns the same results. You're given two sample calls to the procedure, and your goal is to make it as fast as possible.