日期:2014-05-17 浏览次数:20539 次
SELECT Name , ClassName , Grade,
[优]=MAX(CASE WHEN [level]='优' THEN paperCount ELSE 0 END ),
[良]=MAX(CASE WHEN [level]='良' THEN paperCount ELSE 0 END ),
[中]=MAX(CASE WHEN [level]='中' THEN paperCount ELSE 0 END ),
[差]=MAX(CASE WHEN [level]='差' THEN paperCount ELSE 0 END )
FROM TB
GROUP BY Name , ClassName , Grade