Re: Repost - Grouping query
- From: "Michel Walsh" <vanderghast@VirusAreFunnierThanSpam>
- Date: Wed, 24 May 2006 13:40:24 -0400
Hi,
Sometimes, if appropriate, add the extra fields in the GROUP BY, then, you
can also add them in the SELECT clause.
Another alternative, if the other fields all have the same value, or if just
some value from a record from the group is appropriate, aggregate the other
fields with LAST:
===============
SELECT QuestionNumber, COUNT(*), COUNT(Value), LAST(otherField1),
LAST(otherField2)
FROM mytable
GROUP BY QuestionNumber
================
Hoping it may help,
Vanderghast, Access MVP
"Red via AccessMonster.com" <u15475@uwe> wrote in message
news:60bad8647c858@xxxxxx
Hi Michel,
Thanks for youe reply. Your SQL worked exactly as I wanted it to for
QuestionNumber. I've been trying to manipulate it to include the rest of
the
fields with no luck. Any suggestions on how to incorporate the rest of my
required fields Value and PassValue into this SQL?
Many Thanks for your help.
Red
Michel Walsh wrote:
Hi,
COUNT(*) will count the number of records, COUNT(Value) will count the
number of records where the value is not null (not n/a).
SELECT QuestionNumber, COUNT(*), COUNT(Value)
FROM mytable
GROUP BY QuestionNumber
seems to be what you need.
Hoping it may help,
Vanderghast, Access MVP
After much research on this site, have come to the following[quoted text clipped - 52 lines]
conclusions
on
Thanks in advance for any advice given.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200605/1
.
- Follow-Ups:
- Re: Repost - Grouping query
- From: Red via AccessMonster.com
- Re: Repost - Grouping query
- References:
- Repost - Grouping query
- From: Red via AccessMonster.com
- Re: Repost - Grouping query
- From: Michel Walsh
- Re: Repost - Grouping query
- From: Red via AccessMonster.com
- Repost - Grouping query
- Prev by Date: Re: Cannot make delete duplicates query work
- Next by Date: Re: Query Help
- Previous by thread: Re: Repost - Grouping query
- Next by thread: Re: Repost - Grouping query
- Index(es):