Dumping it into a temp table isn't hard, but you could also consider using derived tables. The derived table is calculated within your parenthesis. I've included a link to a page for you to review. http://www.sqlteam.com/article/using-derived-tables-to-calculate-aggregate-values