Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Help
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
![]() |
![]() |