Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / July 2007

Tip: Looking for answers? Try searching our database.

Count in Query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
trainsteve - 17 Jul 2007 18:00 GMT
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
Douglas J. Steele - 17 Jul 2007 18:32 GMT
SELECT qNom.Nominee, Count(qNom.Nominee) AS Nominations
FROM qNom
GROUP BY qNom.Nominee
ORDER BY qNom.Nominee

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I want table of nominations which includes the Nominee, Nominator, and
>reason
[quoted text clipped - 22 lines]
>
> Thanks
trainsteve - 17 Jul 2007 18:52 GMT
Thanks. That works.

> SELECT qNom.Nominee, Count(qNom.Nominee) AS Nominations
> FROM qNom
[quoted text clipped - 27 lines]
> >
> > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.