0
我有以下查詢:SQL重命名行結果
SELECT * FROM [dbo].[SellThruDaily852] WHERE RetailerID='AMAZON' --order by StartDate
AND StartDate in (20170731,20170801,20170802,20170803,20170804,20170805,20170806);
WITH AMAZON AS
(
SELECT
MAX(ProcessRunId) ProccessID,
DATEPART(YY,DATEADD(DD,-1,CAST(CreatedDate AS DATE))) VizioYear ,
DATEPART(WK,DATEADD(DD,-1,CAST(CreatedDate AS DATE))) WeekID,
CAST(DATENAME(dw,CAST(CreatedDate AS DATE)) AS VARCHAR) DayName,
FileName,
CAST(CreatedDate AS DATE) CreateDate
--CreatedDate
FROM [dbo].[FileCheckResult]
WHERE
RetailerID='AMAZON'
AND FileCheckType='Received'
AND FileDataType='SellThru'
AND FileName like '852_AMAZON_9%'
GROUP BY FileName,CAST(CreatedDate AS DATE)
)
SELECT
*
FROM AMAZON
WHERE
VizioYear=2017
AND WeekID=31
ORDER BY CreateDate
這是結果:
我想要做的是什麼DAYNAME前兩行更改爲 - 週一和週二。
任何想法?