Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Syntax to select and return percentage

I have the two queries below. I need to combine them to get a percentage.

I want to divide the first one over the second one.

SELECT COUNT (activityid) AS completedcount FROM dbo.Activities
WHERE ActType = 'HISTORY' AND dateInitiated IS NOT null
AND CaseId = 13701

SELECT COUNT (activityid) AS totalcount FROM dbo.Activities
WHERE ActType = 'HISTORY'
AND CaseId = 13701

Open in new window


Should end up being something like  5/7 = .71
And I need to return it as a percentage like:  71%

How can I do this?
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Thanks!