Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Help
You have to use GROUP BY !!
example:
select column1 , count(*) from table
+--------------------------------------------------------------------------+ | Vitaliy Mogilevskiy | Senior Consultant | CORE Technology Group, Inc. | E-mail: vit100gain_at_earthlink.net | Fax : (707) 516-2163 | Web Page: http://home.earthlink.net/~vit100gain/index.html | *** Free DBA Script Library at my Web Page *** +--------------------------------------------------------------------------+
Paul Davies wrote:
> I have the following query:
>
> BEGIN
> select
> sum(
> (M_N + M_B + (K_N* cd) + (C_B * cd))
> * (7 / cnt)
> )
> into
> sold
>
> from A_REQ o, CAM c,(select CAM_ID,count(*) cnt from
> CAM_DAY) CAM_DAY
> where
> c.CAM_ID = CAM_DAY.CAM_ID (+)
> and .........
>
> *
> 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
Received on Thu May 06 1999 - 13:26:06 CDT
![]() |
![]() |