Re: SubQuery Problem

From: Suzanne Edgecombe <Suzanne.Edgecombe_at_agso.gov.au>
Date: Fri, 24 Sep 1999 12:47:54 +1000
Message-ID: <7seonn$dmi3_at_thredbo.dpie.gov.au>


Hi There,

What is it you are trying to achieve with the query?

If you want to count the number of records where the parent = the value 1, then

select count(*), parent
from emp
having parent = 1
group by parent;

will work and will give you something like:

Count(*),     Parent
542              1

Since count is a group funtion, you need to group everything else in the query, and substitute having for where in the conditions clause

Cheers,

Sue E

Avia wrote in message <7sdm1m$d9q$1_at_news2.inter.net.il>...
>
>Hey,
>
> I am trying to run an oracle query that looks like that:
>
> SELECT parent,(SELECT COUNT(*) FROM emp)
> FROM emp
> WHERE parent = 1;
>
> And it doesn't work. I will appreciate any help in the subject.
> Avi.
>
>
Received on Fri Sep 24 1999 - 04:47:54 CEST

Original text of this message