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
13,326 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
Question by:ksearch
    2 Comments
     
    LVL 50

    Accepted Solution

    by:
    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
    Yay for LowFatSpread!  that did it. Thanks!  Calling the wrong field in the groupby property was the problem. Thanks so much!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
    SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
    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…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    875 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now