34,588
社区成员
发帖
与我相关
我的任务
分享
DECLARE @text VARCHAR(8000)
SET @text = 'select textNo,textName'
SELECT @text = @text + ', max(case TextDate when '''
+ CONVERT(VARCHAR(10), textDate, 23) + ''' then score else 0 end) ['
+ TextDate + ']'
FROM ( SELECT DISTINCT
[Date]
FROM [text]
) AS a
SET @text = @text + 'from text group by textNo,textName'
EXEC(@text)