?
Solved

Access Query

Posted on 2013-10-23
4
Medium Priority
?
267 Views
Last Modified: 2013-10-23
Hi guys

I am trying to get Month to date sum from two tables and cal efficiency its giving an error
That expression is not include as  a part of aggregate  function.

SELECT SETTLEMENT.[SDate], SETTLEMENT.[RepName], Sum(SETTLEMENT.[Hours Work]) AS [SumOfHours Work], Sum(SETTLEMENT.[Swift]) AS SumOfSwift, Sum(SETTLEMENT.[Phone Calls]) AS [SumOfPhone Calls], Sum(SETTLEMENT.[Meetings]) AS SumOfMeetings, Sum(SETTLEMENT.[Training]) AS SumOfTraining, Sum(SETTLEMENT.[Compliance]) AS SumOfCompliance, Sum(SETTLEMENT.[QA]) AS SumOfQA, Sum(SETTLEMENT.[Oracle Input]) AS [SumOfOracle Input], Sum(SETTLEMENT.[Bank Input]) AS [SumOfBank Input], Sum(SETTLEMENT.[Bank Auth]) AS [SumOfBank Auth], Sum(SETTLEMENT.[Insurances]) AS SumOfInsurances, Sum(SETTLEMENT.[Other]) AS SumOfOther, Sum(SettDPCAT.NewSettled) AS NS, Sum(SettDPCAT.NewHeld) AS NH, Sum(SettDPCAT.HeldSettled) AS HS, Sum(SettDPCAT.HeldReHeld) AS HRH, Sum((([Hours Work])*86400)) AS TH, ((([NS]*1200+[NH]*1500+[HS]*300+[HRH]*300+[S]*90+[Phone Calls]*120+[Meetings]*1800+[Training]*1800+[Compliance]*1800+[QA]*1800+[Oracle Input]*90+[Bank Input]*120+[Bank Auth]*60+[Insurances]*90+[Other]*1800)/([TH]))) AS Efficiency
FROM SettDPCAT INNER JOIN SETTLEMENT ON (SettDPCAT.RepName = SETTLEMENT.RepName) AND (SettDPCAT.[Today Date] = SETTLEMENT.SDate)
GROUP BY SETTLEMENT.[SDate], SETTLEMENT.[RepName]
HAVING (((SETTLEMENT.[SDate]) Between [sd] And [ed]));

Open in new window

0
Comment
Question by:surah79
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 26

Accepted Solution

by:
jerryb30 earned 1500 total points
ID: 39595836
Maybe:
SELECT SETTLEMENT.[SDate], SETTLEMENT.[RepName], Sum(SETTLEMENT.[Hours Work]) AS [SumOfHours Work], Sum(SETTLEMENT.[Swift]) AS SumOfSwift, Sum(SETTLEMENT.[Phone Calls]) AS [SumOfPhone Calls], Sum(SETTLEMENT.[Meetings]) AS SumOfMeetings, Sum(SETTLEMENT.[Training]) AS SumOfTraining, Sum(SETTLEMENT.[Compliance]) AS SumOfCompliance, Sum(SETTLEMENT.[QA]) AS SumOfQA, Sum(SETTLEMENT.[Oracle Input]) AS [SumOfOracle Input], Sum(SETTLEMENT.[Bank Input]) AS [SumOfBank Input], Sum(SETTLEMENT.[Bank Auth]) AS [SumOfBank Auth], Sum(SETTLEMENT.[Insurances]) AS SumOfInsurances, Sum(SETTLEMENT.[Other]) AS SumOfOther, Sum(SettDPCAT.NewSettled) AS NS, Sum(SettDPCAT.NewHeld) AS NH, Sum(SettDPCAT.HeldSettled) AS HS, Sum(SettDPCAT.HeldReHeld) AS HRH, Sum((([Hours Work])*86400)) AS TH, ((([NS]*1200+[NH]*1500+[HS]*300+[HRH]*300+[S]*90+[Phone Calls]*120+[Meetings]*1800+[Training]*1800+[Compliance]*1800+[QA]*1800+[Oracle Input]*90+[Bank Input]*120+[Bank Auth]*60+[Insurances]*90+[Other]*1800)/([TH]))) AS Efficiency
FROM SettDPCAT INNER JOIN SETTLEMENT ON (SettDPCAT.RepName = SETTLEMENT.RepName) AND (SettDPCAT.[Today Date] = SETTLEMENT.SDate)
GROUP BY SETTLEMENT.[SDate], SETTLEMENT.[RepName],(([NS]*1200+[NH]*1500+[HS]*300+[HRH]*300+[S]*90+[Phone Calls]*120+[Meetings]*1800+[Training]*1800+[Compliance]*1800+[QA]*1800+[Oracle Input]*90+[Bank Input]*120+[Bank Auth]*60+[Insurances]*90+[Other]*1800)/([TH])))
HAVING (((SETTLEMENT.[SDate]) Between [sd] And [ed]));

Open in new window

0
 
LVL 26

Expert Comment

by:jerryb30
ID: 39595857
Can you post a small (sanitized) sample, with your query? And desired results? If this is with linked tables, you'll have to spoof things by importing necessary tables/data.
0
 

Author Closing Comment

by:surah79
ID: 39595939
Thanks a lot
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 39595955
Just curious. Why the B?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question