I\'d like to combine two queries
SELECT COUNT(*) FROM abc;
SELECT COUNT(Status) FROM ABC WHERE Status=\'Active\';
And then calculate the percen
This should give you what you want:
SELECT
COUNT(*) AS TotalCount,
SUM(IIF(Status = 'Active', 1, 0)) AS ActiveCount,
ROUND((SUM(IIF(Status = 'Active', 1, 0)) * 100/ COUNT(*)),2) AS PctActive
FROM
Abc
EDIT: Didn't notice that this was for Access. I don't know if CAST
is available in Access, so you may need to use an equivalent function to make sure that the integers don't simply yield 1 or 0. It's possible that Access will convert a division into a decimal automatically, but in SQL Server it does not.