sorkIndustries
Technical User
In table UserInfo, I have three fields: Users, Requests, and Approvals. For each user, I want to find the percentage of requests that are approved. Here is some sample data:
User|Request|Approval
----+---------+--------
A Y Y
B N N
C Y N
A N N
B Y Y
B Y N
C Y Y
A N N
A Y N
So, for each user, I want to find total "Y" approvals divided by total "Y" requests.
I've tried this using:
select User,100*count([Approval]="Y")/count([Request]="Y") as [Success Rate] from UserInfo group by User;
It doesn't work. I just get 100% for every user.
How can I get the query to list the users and their percentages?
User|Request|Approval
----+---------+--------
A Y Y
B N N
C Y N
A N N
B Y Y
B Y N
C Y Y
A N N
A Y N
So, for each user, I want to find total "Y" approvals divided by total "Y" requests.
I've tried this using:
select User,100*count([Approval]="Y")/count([Request]="Y") as [Success Rate] from UserInfo group by User;
It doesn't work. I just get 100% for every user.
How can I get the query to list the users and their percentages?