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: using COUNT and retrieve field in same query

Re: using COUNT and retrieve field in same query

From: Bricklen <bricklen-rem_at_yahoo.comz>
Date: Mon, 19 Jan 2004 22:29:33 GMT
Message-ID: <hTYOb.47140$De.33001@edtnps84>


Oliver Spiesshofer wrote:
> Hi,
>
> Ihave been trying to do a count and retrieve a field from within the same
> query:
>
> SELECT field1, count(field2) FROM table1 WHERE field3=1;
>
> but I always get the following error:
>
> not a single-group group function
>
> what am I doing wrong? is this possible at all to do?
>
>
> thanks
>
> Oliver
>

You have to apply the group function, just like it says:

select field1,count(field2) from table1 where field3=1 group by field1;

tahiti.oracle.com is a great place to brush up on these skills. Received on Mon Jan 19 2004 - 16:29:33 CST

Original text of this message

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