;WITH myRubbish AS
(
SELECT user, [20121231], [20130101], [20130102]
FROM
(
SELECT
DateKey,
user,
revenue
FROM xxx.dbo.yyy
WHERE DateKey > CONVERT(CHAR(8),GETDATE()-4,112)
) x
PIVOT
(
SUM(revenue)
FOR DateKey IN ([20121231], [20130101], [20130102])
) u
)
SELECT *
FROM myRubbish;
毎日実行でき、列の名前が過去3日間に自動的に変更されるように、これをどのように調整しますか?