我有下表,但不确定是否可以旋转它并保留所有标签。
RATIO RESULT SCORE GRADE
Current Ratio 1.294 60 Good
Gearing Ratio 0.3384 70 Good
Performance Ratio 0.0427 50 Satisfactory
TOTAL NULL 180 Good
我会承认对枢轴的使用不是很好,因此经过几次尝试导致此输出:
SELECT 'RESULT' AS 'Ratio'
,[Current Ratio] AS 'Current Ratio'
,[Gearing Ratio] AS 'Gearing Ratio'
,[Performance Ratio] AS 'Performance Ratio'
,[TOTAL] AS 'TOTAL'
FROM
(
SELECT RATIO, RESULT
FROM GRAND_TOTALS
) AS SREC
PIVOT
(
MAX(RESULT)
FOR RATIO IN ([Current Ratio],[Gearing Ratio], [Performance Ratio], [TOTAL])
) AS PVT
结果如下:
Ratio Current Ratio Gearing Ratio Performance Ratio
Result 1.294 0.3384 0.0427
我承认在下一步该怎么做才能产生所需的结果时感到很沮丧:
Ratio Current Ratio Gearing Ratio Performance Ratio TOTAL
Result 1.294 0.3384 0.0427 NULL
Score 60 70 50 180
Grade Good Good Satisfactory Good
蝴蝶不菲
相关分类