Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: [student] How to correct this error?

Re: [student] How to correct this error?

From: Alan D. Mills <alanmNOSPAM_at_uk.europe.mcd.mot.com>
Date: Mon, 26 Oct 1998 14:47:21 -0000
Message-ID: <71220l$bcm$1@schbbs.mot.com>


You get this error when you fail to group by the values retrieved that you wish to aggregate over. In short this means add a GROUP BY clause at the bottom of your SQL and include in the list all retrieved items in your SELECT list which you are not aggregated in your query.

TO explain, lets consider the SQL

SELECT deptno, SUM(salary)

   FROM WhatevereTable

What we want to do is display each deptno along with the sum of salary values for the particular deptno. WE need to tell Oracle that we wish to aggregate salary within individual values for deptno and the way we do this is by the GROUP BY clause. The above will gove an error but

SELECT deptno, SUM(salary)
FROM WhatevereTable
GROUP BY deptno

will not.

--
Alan D. Mills

Oliver White wrote in message <36347579.31827668_at_news.m.iinet.net.au>...
>
>ORA-00937: not a single-group group function
>
>I'm not entirely sure what this means, here is my script for
>diagnosis:
>

.
>MHM 22x9
>--
>
Received on Mon Oct 26 1998 - 08:47:21 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US