Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: using COUNT and retrieve field in same query
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
![]() |
![]() |