CREATE TABLE SalesByQuarterId
(
id int identity primary key,
year INT,
quarter CHAR(2),
amount MONEY
)
SELECT * FROM SalesByQuarterID
PIVOT
(
SUM (amount)
FOR quarter IN (Q1, Q2, Q3, Q4)
) AS P
ORDER BY YEAR DESC
a
b
c
