Advertisement

08.16.2005 at 03:09PM PDT, ID: 21529386
[x]
Attachment Details

Yet another 'Group By' syntax question

Asked by Galisteo8 in Microsoft Access Database

Tags: group

I am trying to get the following to work, but it seems that once any single aggregate function gets introduced into a query, then suddenly the query wants ALL of the SELECTed expressions to be in an aggregate function -- and not all of them are able to be 'aggregated', i.e. text:

For example:

SELECT LastFirstQuery.division AS Division,
count(newEmpTrainQuery.EmployeeID) AS EmpNum,
count(newEmpTrainQuery.TrainingID) AS CourseNum,
newEmpTrainQuery.[Course Category] AS Category

FROM newEmpTrainQuery, LastFirstQuery
WHERE (((LastFirstQuery.id)=newEmpTrainQuery.EmployeeID))
GROUP BY  Division;

I will be using this query to generate a report that presents the results of the query with Division as the primary grouping, and Category as the secondary grouping, with totals under each category (EmpNum, and CourseNum).
The error I get tells me that I need to use 'category' in an aggregate function, but frankly I have no need to add, multiply, divide, or average my Category data -- it's text.  What do I do to avoid this error?
(Full error, as you well know: "You tried to execute a query that dones not include the specified expression 'Category' as part of an aggregate function.")
Start Free Trial
[+][-]08.16.2005 at 03:11PM PDT, ID: 14687450

View this solution now by starting your 7-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

Zone: Microsoft Access Database
Tags: group
Sign Up Now!
Solution Provided By: perkc
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.16.2005 at 03:12PM PDT, ID: 14687454

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.16.2005 at 03:19PM PDT, ID: 14687483

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.16.2005 at 04:05PM PDT, ID: 14687685

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.16.2005 at 04:47PM PDT, ID: 14687865

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.16.2005 at 09:24PM PDT, ID: 14689030

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32