SQL Server 2012-添加摘要行

时间:2019-11-08 19:47:08

标签: sql-server-2012

我有此代码

SELECT 
    B.TABLENAME AS [TABLE NAME], 
    B.SIZE AS [SIZE PRE-CLEANUP GIG(S)], 
    A.SIZE AS [SIZE POST-CLEANUP GIG(S)], 
    B.SIZE - A.SIZE AS [SIZE CHANGE GIG(S)],
    CASE
       WHEN B.SIZE = 0 OR A.SIZE = 0
           THEN '0.0%'
           ELSE FORMAT((B.SIZE-A.SIZE)/B.SIZE, 'P1')
    END AS [PERCENTAGE OF CHANGE]
FROM 
    ZERO_BALANCE.DBO.TMP_TABLE_STATS_BEG AS B
JOIN
    ZERO_BALANCE.DBO.TMP_TABLE_STATS_END AS A ON A.TABLENAME = B.TABLENAME

显示与附件图像相似的表格。我如何为此做一个摘要行?

enter image description here

0 个答案:

没有答案