我在两个不同的枢轴上得到计数值和总和。请指导我如何在单个查询中实现这两个功能。
计数枢轴:
SELECT * FROM (
SELECT ClaimValue, CurrentBalance, AgeBucket
FROM AR_Claim_Master
WHERE ClientName = 'NXT'
) m
PIVOT (
COUNT(CurrentBalance)
FOR AgeBucket IN ([0-30],[31-60],[61-90],[91-120],[121-210],[>210])
) n
总和枢轴:
SELECT * FROM (
SELECT ClaimValue, CurrentBalance, AgeBucket
FROM AR_Claim_Master
WHERE ClientName = 'NXT'
) m
PIVOT (
SUM(CurrentBalance)
FOR AgeBucket IN ([0-30],[31-60],[61-90],[91-120],[121-210],[>210])
) n
我想要这个图像的结果。请帮帮我。