Group by

  • Thread starter Thread starter molly
  • Start date Start date
M

molly

Hello,
I have a trouble with group by statement could you help me
out. Here is my query:

SELECT dbo_cumh.*
FROM dbo_cumh
WHERE [dbo_cumh].[testyr]="2004"
GROUP BY [dbo_cumh].[id], [dbo_cumhiv].[mon]

I got an error. Can't use group by ???
Regards,
Molly
 
Dear Molly:

On the practical side, why do you want to GROUP at all? GROUPing is
usually done when there is an aggregate to be performed, and you don't
have one.

On a technical side, when you do any GROUPing, you must GROUP by every
column that is not aggregated. Your GROUP BY statement would have to
explicitly list EVERY column in the table. I don't know how many that
may be, as you are selecting them all.

If you don't want to group, click the "sigma" icon to turn off totals
(aggregates) and you should then be fine.

I also noticed your GROUP BY statement's second column references a
different table [dbo_cumhiv] than the only table in the FROM
statement. This must be a mistake somehow.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top