Count in Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want table of nominations which includes the Nominee, Nominator, and reason
for the nomination. The database allows for multiple Nominees per nomination,
so I used a UNION query to deal with that.

I want to be able to count how many nominations a each person recieved, so
that when I run the query i get something like this:

Nominee Nominations
Randy 3
Sue 1
Jack 2
Ann 1

Here is the SQL statement I am using:

SELECT qNom.Nominee, Count(qNom.Nominee) AS Nominations
FROM qNom;

But i get an error message stating I tried to run a query that
'qNom.Nominee' is not part of the aggregate function.

Any ideas on how to resolve this?

Thanks
 
SELECT qNom.Nominee, Count(qNom.Nominee) AS Nominations
FROM qNom
GROUP BY qNom.Nominee
ORDER BY qNom.Nominee
 
Thanks. That works.

Douglas J. Steele said:
SELECT qNom.Nominee, Count(qNom.Nominee) AS Nominations
FROM qNom
GROUP BY qNom.Nominee
ORDER BY qNom.Nominee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

nomination table design 10
text box #error 1
Report Laterally 3
Update query 2
Accounts functions 4
Query results limited 5
Criteria in reports 4
IF Statement: cell referencing 5

Back
Top