If you used the query provided by Lowell, it does not create a temp table. He used a cte.
But a temp table would be efficient in handling this type of thing too.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events