我正在尝试查找以下查询的每月百分比(过去12个月)
明智地说,如果有人能帮助我,那就太棒了SELECT Month(a.[Work Initated Date]) AS Month, a.[Initial Severity],
(CAST(Count(a.[Case Number]) AS Decimal(10,1))/ (select CAST(Count(a.[Case Number]) AS Decimal(10,1))
FROM [DSTRINING].[dbo].[SFDC WorkInitiated] (nolock) a
where a.[Initial Severity]='Critical' AND Month(a.[Work Initated Date])=Month(getdate()))*100) AS 'Work Initated%'
FROM [DSTRINING].[dbo].[SFDC WorkInitiated] (nolock) a
where a.[Initial Severity]='Critical' AND Month(a.[Work Initated Date])=Month(getdate()) AND a.[Work Initiated Target Breached]='NO'
Group by Month(a.[Work Initated Date]), a.[Initial Severity]