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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: COunt problem

Re: COunt problem

From: Daniel Fink <dan.fink_at_hotsos.com>
Date: Tue, 14 Jun 2005 06:33:47 -0600
Message-ID: <42AECEAB.9080108@hotsos.com>


You could also use a scalar subquery.

SELECT
    (SELECT COUNT(idcode) FROM emp) emp_count,     (SELECT COUNT(idcode) FROM emp_dis) emp_dis_count FROM dual;

Regards,
Dan Fink

Mercadante, Thomas F (LABOR) wrote:

>Kean,
>
>You can do it this way:
>
>Select emp_count, emp_dis_count
>
>From (
> select count(a.idcode) emp_count
> from emp
> ),
> (
> select count(b.idcode) emp_dis_count
> from emp_dis b
> )
>
>Your method is performing a Cartesian join involving both tables. The
>result would be bad.
>
>Tom
>
>
>-----Original Message-----
>From: oracle-l-bounce_at_freelists.org
>[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Kean Jacinta
>Sent: Monday, June 13, 2005 10:29 PM
>To: oracle-l_at_freelists.org
>Subject: COunt problem
>
>Hi ,
>
>I am trying to do a count on 2 table at the same time.
>
>select count(a.idcode), count(b.idcode)
>from emp a, emp_dis b
>
>The result return are not corrent. Both idcode
>datatype is number.
>
>Actual table count for emp : 15
>Actual table count for emp_dis :25
>
>Thank You
>JK
>
>
> =09
>__________________________________=20
>Yahoo! Mail=20
>Stay connected, organized, and protected. Take the tour:=20
>http://tour.mail.yahoo.com/mailtour.html=20
>
>--
>http://www.freelists.org/webpage/oracle-l
>--
>http://www.freelists.org/webpage/oracle-l
>
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Jun 14 2005 - 08:39:06 CDT

Original text of this message

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