Query Strategy for this please?
-
Monday, November 19, 2012 11:57 PM
There are two tables, AccountsOpen and AccountsClosed, which keeps track of which employee has openedand closedeach account
AccountsOpen
EmployeeID (int)
AccountID (int)
AccountsClosed
EmployeeID (int)
AccountD (int)
If an employee closes an account they get 1 point
If no one closes an account, the employee that opens the account gets 1 point
All Replies
-
Tuesday, November 20, 2012 2:39 PM
Run this query:
select EmployeeID, sum(points) from (select EmployeeID, count(*) as points from AccounsOpen group by EmployeeID union select EmployeeID, count(*) as points from AccountsClosed group by EmployeeID) t group by EmployeeID
- Edited by irusulMicrosoft Community Contributor Tuesday, November 20, 2012 2:39 PM
- Proposed As Answer by Fanny LiuMicrosoft Contingent Staff, Moderator Wednesday, November 21, 2012 1:07 AM
- Marked As Answer by Fanny LiuMicrosoft Contingent Staff, Moderator Monday, November 26, 2012 10:16 AM

