From oracle-l-bounce@freelists.org Tue Jun 14 08:08:02 2005 Return-Path: Received: from air891.startdedicated.com (root@localhost) by orafaq.com (8.12.10/8.12.10) with ESMTP id j5ED82wj023538 for ; Tue, 14 Jun 2005 08:08:02 -0500 X-ClientAddr: 206.53.239.180 Received: from turing.freelists.org (freelists-180.iquest.net [206.53.239.180]) by air891.startdedicated.com (8.12.10/8.12.10) with ESMTP id j5ED82Ni023533 for ; Tue, 14 Jun 2005 08:08:02 -0500 Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 07C901BD763; Tue, 14 Jun 2005 07:04:45 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14348-01; Tue, 14 Jun 2005 07:04:44 -0500 (EST) Received: from turing (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id AFCC71BD778; Tue, 14 Jun 2005 07:04:43 -0500 (EST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=p89cJTbOalob3peprvAjutkCdaiPEhp6dt82pXBcym153iMNFlHAFXpbLYdkPNMBF/xySVyw3y1nLgmR9sBsEl9lSFYh8gNnBaAThL2h80TbaItCUhOhyUgMj9GAQCJKcQJwPZgxd41kWufX6gL7qf5T/OypxFxIo7jLtCbFH1Y= Message-ID: <23e0d117050614050265a8911@mail.gmail.com> Date: Tue, 14 Jun 2005 14:02:49 +0200 From: Giovanni Cuccu To: jacintakean@yahoo.com Subject: Re: COunt problem Cc: oracle-l@freelists.org In-Reply-To: <20050614022832.87742.qmail@web52907.mail.yahoo.com> Mime-Version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Disposition: inline References: <20050614022832.87742.qmail@web52907.mail.yahoo.com> X-archive-position: 21072 X-ecartis-version: Ecartis v1.0.0 Sender: oracle-l-bounce@freelists.org Errors-To: oracle-l-bounce@freelists.org X-original-sender: giovanni.cuccu@gmail.com Precedence: normal Reply-To: giovanni.cuccu@gmail.com X-list: oracle-l X-Virus-Scanned: by amavisd-new-20030616-p9 (Debian) at avenirtech.net X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on air891.startdedicated.com X-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.63 Hi, if you want try to avoid the cartesian join you could write a query like the following one: Connected as test SQL> create table emp as select * from all_objects where rownum<=3D1234; Table created SQL> create table emp_dis as select * from all_objects where rownum<=3D5678= ; Table created SQL> select sum(emp_n),sum(emp_dis_n) from ( 2 select decode(t,1,num,0) emp_n,decode(t,2,num,0) emp_dis_n 3 from (select 1 t,count(*)num from emp 4 union select 2 t, count(*) num from emp_dis)) 5 ; SUM(EMP_N) SUM(EMP_DIS_N) ---------- -------------- 1234 5678 Giovanni On 6/14/05, Kean Jacinta wrote: > Hi , >=20 > I am trying to do a count on 2 table at the same time. >=20 > select count(a.idcode), count(b.idcode) > from emp a, emp_dis b >=20 > The result return are not corrent. Both idcode > datatype is number. >=20 > Actual table count for emp : 15 > Actual table count for emp_dis :25 >=20 > Thank You > JK >=20 >=20 >=20 > __________________________________ > Yahoo! Mail > Stay connected, organized, and protected. Take the tour: > http://tour.mail.yahoo.com/mailtour.html >=20 > -- > http://www.freelists.org/webpage/oracle-l >=20 --=20 -------------------------------------------------------------------- Another free oracle resource profiler http://sourceforge.net/projects/oraresprof/ New version 0.8 with many bug fixes and warnings on file truncated, timed_statistics=3Dfalse, incorrect tracing deactivation and more -- http://www.freelists.org/webpage/oracle-l