PC Review


Reply
Thread Tools Rate Thread

Count in Query

 
 
=?Utf-8?B?dHJhaW5zdGV2ZQ==?=
Guest
Posts: n/a
 
      17th Jul 2007
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
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      17th Jul 2007
SELECT qNom.Nominee, Count(qNom.Nominee) AS Nominations
FROM qNom
GROUP BY qNom.Nominee
ORDER BY qNom.Nominee


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


"trainsteve" <(E-Mail Removed)> wrote in message
news:C25A5F49-5C23-4058-91AE-(E-Mail Removed)...
>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



 
Reply With Quote
 
=?Utf-8?B?dHJhaW5zdGV2ZQ==?=
Guest
Posts: n/a
 
      17th Jul 2007
Thanks. That works.

"Douglas J. Steele" wrote:

> SELECT qNom.Nominee, Count(qNom.Nominee) AS Nominations
> FROM qNom
> GROUP BY qNom.Nominee
> ORDER BY qNom.Nominee
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "trainsteve" <(E-Mail Removed)> wrote in message
> news:C25A5F49-5C23-4058-91AE-(E-Mail Removed)...
> >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

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
count wirth zero count query inungh Microsoft Access Queries 2 16th Jan 2009 11:48 AM
Count unique in a query instead of count # BlueWolverine Microsoft Access Queries 5 17th Oct 2008 07:25 PM
Query - Count of Cases and Count of where Resolution Not Completed mralmackay@aol.com Microsoft Access Queries 1 12th Mar 2008 08:47 PM
how to get count(col1), count(col2), count(sol3) with only one query Mario Krsnic Microsoft Access Queries 2 27th Oct 2006 06:52 PM
Query: Highest Count to Lowest Count Xenophobe Microsoft Access Queries 2 20th Feb 2004 04:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:33 PM.