A family of Microsoft relational database management systems designed for ease of use.
You have to include all fields in the GROUP BY statement that do not have Avg, Count, Sum, Min, Max, etc.
What are you trying to accomplish?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, I'm trying to execute this query:
SELECT YOUNGPERSON.IDNUMBER, YOUNGPERSON.SURNAME
FROM YOUNGPERSON
GROUP BY YOUNGPERSON.SURNAME;
but I get the following error from MS Access(2007) :
"You tried to execute a query that does not include the specified expression 'IDNUMBER' as part of an aggregate function".
Microsoft's documentation implies that an aggregate function is not mandatory for the use of the GROUP BY clause. What;s up?!!
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
You have to include all fields in the GROUP BY statement that do not have Avg, Count, Sum, Min, Max, etc.
What are you trying to accomplish?
Thanks for your response. I can't achieve what I want using the group by. So I'll find another way!
You can get the same results without using GROUP BY
SELECT DISTINCT YOUNGPERSON.IDNUMBER, YOUNGPERSON.SURNAME
FROM YOUNGPERSON
OR
SELECT YOUNGPERSON.IDNUMBER, YOUNGPERSON.SURNAME
FROM YOUNGPERSON
GROUP BY YoungPerson.IdNumber, YOUNGPERSON.SURNAME