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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Help

Re: SQL Help

From: Lothar Armbrüster <lothar.armbruester_at_rheingau.netsurf.de>
Date: 06 May 99 19:39:47 +0100
Message-ID: <1111.795T2392T11794555lothar.armbruester@rheingau.netsurf.de>


Paul Davies wrote on 06-Mai-99 18:11:15:
>I have the following query:

[...]

>When I run the query I get this error:

>ERROR at line 1:
>ORA-00937: not a single-group group function
>ORA-06512: at "SYSTEM.GETSOLD", line 25
>ORA-06512: at line 1

>caused by the subquery (select CAM_ID, count(*) cnt from CAM_DAY)

>I've also seen this error when I use other aggregate functions like
>sum(). I'm new to Oracle and would appreciated it if someone could
>enlighten me as to what it means and how I can stop it.

>Thanks

>Paul

Hello Paul,

you are omitting the 'group by' clause. You can do the following:

select count(*) from cam_day;

But if you have any non aggregated fields in the from clause, you have to write like this:

select cam_id,count(*) from cam_day group by cam_id;

This gives every cam_id along with the number of rows having this ID. Generally, you have to group by every non aggregated field in your from clause.

Hope this helps,
Lothar

--

Lothar Armbrüster       | lothar.armbruester_at_rheingau.netsurf.de
Schulstr. 12            | lothar.armbruester_at_t-online.de
D-65375 Oestrich-Winkel |

Received on Thu May 06 1999 - 13:39:47 CDT

Original text of this message

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