Re: Repost - Grouping query

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
conclusions
on
[quoted text clipped - 52 lines]

Thanks in advance for any advice given.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200605/1


.