I\'ve got a set of data that looks something like this (VERY simplified):
productId Qty dateOrdered --------- --- ----------- 1
You can use either a Union of your queries rather than temp tables or use the pivot option.
Here's a forum discussion on it:
Sql Server Forums - Show the row-wise data as column-wise