Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @TotalActiveRecords INT = (SELECT COUNT(*) FROM Person WHERE RecordStatusValueId = 3) -- Active Records
- SELECT
- CASE AccountProtectionProfile
- WHEN 0 THEN 'Low'
- WHEN 1 THEN 'Medium'
- WHEN 2 THEN 'High'
- WHEN 3 THEN 'Extreme' END,
- COUNT(*) AS [Record Count],
- CAST(((COUNT(*) * 100.0) / @TotalActiveRecords) AS DECIMAL(5, 2)) AS [Percent]
- FROM Person
- WHERE RecordStatusValueId = 3 -- Active
- GROUP BY AccountProtectionProfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement