Pivot query to return multiple repeating groups?
问题 I'm trying to get a result set (which will be inserted into a table) that has multiple repeating groups. Here's a script that shows a very simplified version of the data I'm starting out with: CREATE TABLE #Aggregate( StoreKey int , NumberOfDaysBack int , ThisYearGrossTransactions int , ThisYearGrossPrice money , LastYearGrossTransactions int , LastYearGrossPrice money ) GO INSERT #Aggregate VALUES (10134, 7, 198, 71324.3600, 248, 95889.6089) INSERT #Aggregate VALUES (10131, 7, 9, 1299.8300,