Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

you tried to execute a query that does not include the specified expression ... as part of the aggregate function

Posted on 2004-10-25
2
Medium Priority
?
13,341 Views
Last Modified: 2012-05-05
Good morning!  I have what I hope is an easy question for many of you experts.

When executing this query, I get the error: “you tried to execute a query that does not include the specified expression ‘CompID’ as part of the aggregate function”

SELECT PC.TagNum, Sum(Software.SoftCost) AS SumOfSoftCost
FROM Software, PC
WHERE (((PC.TagNum)=[SoftWare].[TagNum]))
GROUP BY Software.TagNum;

I'm just learning, and muddling my way through, so I appreciate the help.  Are there general rules of thumb that I should know when it comes to Aggregate functions?
thanks!
0
Comment
Question by:ksearch
[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
2 Comments
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 500 total points
ID: 12399896
try
SELECT PC.TagNum, Sum(Software.SoftCost) AS SumOfSoftCost
FROM Software, PC
WHERE (((PC.TagNum)=[SoftWare].[TagNum]))
GROUP BY PC.TagNum;

ingeneral the Group by must contain the same columns that you specify on the Select Statement (including the table..)

 
however it isn't clear where ‘CompID’  comes into play?
0
 
LVL 8

Author Comment

by:ksearch
ID: 12400519
Yay for LowFatSpread!  that did it. Thanks!  Calling the wrong field in the groupby property was the problem. Thanks so much!
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

604 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