[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.7

Simpler way to do this....

Asked by Easyonly in Microsoft Access Database, Databases Miscellaneous, SQL Query Syntax

The result that I am looking for is the top six department with higest amount to each client. I had to create 4 queries to get the reusult I need. yet I am not getting the right thing. I still get 7 or 8.

Also, it cause the query to be very slow. Any suggestions!

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
The first query filter for me all pending status and filter department that I do not want to include:
 
SELECT Sum(ProjectAct_tbl.AmountReimb) AS SumOfAmountReimb, Department_tbl.Department, Organization_tbl.OrganizationID, ProjectAct_tbl.StartDate, ProjectAct_tbl.Participant, ProjectAct_tbl.PaymentStatus
FROM (Organization_tbl INNER JOIN ((Projects_tbl INNER JOIN Invoice_tbl ON Projects_tbl.ProjectID = Invoice_tbl.ProjectID) INNER JOIN (ProjectAct_tbl INNER JOIN Department_tbl ON ProjectAct_tbl.DepartmentID = Department_tbl.DepartmentID) ON Invoice_tbl.InvoiceID = ProjectAct_tbl.InvoiceID) ON Organization_tbl.OrganizationID = Projects_tbl.OrganizationID) INNER JOIN ProjectSub_tbl ON (ProjectSub_tbl.ProjectSub = Invoice_tbl.ProjectSub) AND (Projects_tbl.ProjectID = ProjectSub_tbl.ProjectID)
GROUP BY Department_tbl.Department, Organization_tbl.OrganizationID, ProjectAct_tbl.StartDate, ProjectAct_tbl.Participant, ProjectAct_tbl.PaymentStatus, ProjectAct_tbl.DepartmentID
HAVING (((ProjectAct_tbl.Participant)="1") AND ((ProjectAct_tbl.PaymentStatus) Not Like "*pending*") AND ((ProjectAct_tbl.DepartmentID)<>32));
 
The second one group the total by organizationID
 
2)
SELECT [1Departmentsbyall].Department, Sum([1Departmentsbyall].SumOfAmountReimb) AS SumOfSumOfAmountReimb, [1Departmentsbyall].OrganizationID
FROM 1Departmentsbyall
GROUP BY [1Departmentsbyall].Department, [1Departmentsbyall].OrganizationID;
 
3) filter the top six but is not doing that correctly
 
SELECT qtotReimb.Department, qtotReimb.OrganizationID, qtotReimb.SumOfSumOfAmountReimb
FROM qtotReimb
WHERE (((qtotReimb.Department) In (SELECT TOP 6 Department
 FROM qtotReimb r
 WHERE qtotReimb.OrganizationID = r.OrganizationID ORDER BY SumofSumofAmountReimb DESC)));
 
This is the one in the actual graph.
 
4) SELECT DashHigestpaybydept_qry.Department, Sum(DashHigestpaybydept_qry.SumOfSumOfAmountReimb) AS SumOfSumOfSumOfAmountReimb, DashHigestpaybydept_qry.OrganizationID
FROM DashHigestpaybydept_qry
GROUP BY DashHigestpaybydept_qry.Department, DashHigestpaybydept_qry.OrganizationID
HAVING (((Sum(DashHigestpaybydept_qry.SumOfSumOfAmountReimb))>2000));
 
Related Solutions
Keywords: Simpler way to do this....
 
Loading Advertisement...
 
[+][-]10/07/09 11:14 AM, ID: 25518220Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Microsoft Access Database, Databases Miscellaneous, SQL Query Syntax
Sign Up Now!
Solution Provided By: matthewspatrick
Participating Experts: 3
Solution Grade: A
 
[+][-]10/07/09 09:24 AM, ID: 25517146Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/09 09:35 AM, ID: 25517266Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/09 09:56 AM, ID: 25517479Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/09 10:24 AM, ID: 25517733Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/09 10:45 AM, ID: 25517936Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/09 01:13 PM, ID: 25519517Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625