Ed Wagner (2/27/2013)
I like Lynne's approach of splitting it inline and keeping it to a single query instead of using temp tables. Also, her function will be usable elsewhere.
Two minor comments. One, my name doesn't end in an "e". Two, I am a guy, not a gal.