Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: a select within a count ??

Re: a select within a count ??

From: andrewst <member14183_at_dbforums.com>
Date: Tue, 01 Jul 2003 10:15:16 +0000
Message-ID: <3061438.1057054516@dbforums.com>

Originally posted by Andre
> Hello all,
>
> I have a query, but it's not working.
>
> Can someone help me:
>
> select count(*), count(select distinct My_id from Anytable where My_id
> < 1000) from Anytable;
>
> In other words I want to execute a subquery within a count-statement.
> Is it possible ???
>
> Thx!,
> Andre

I can't understand what you want to do either. But instead of count(select) it should be select(count), e.g.

SQL> select deptno, (select count(*) from emp where deptno=dept.deptno) SQL> emp_count
  2* from dept;

    DEPTNO EMP_COUNT
---------- ----------

        10          3
        20          5
        30          6
        40          0

--
Posted via http://dbforums.com
Received on Tue Jul 01 2003 - 05:15:16 CDT

Original text of this message

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