Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: COunt problem
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 <jacintakean_at_yahoo.com> wrote:
> Hi ,
>=20
>=20
>=20
>=20
>=20
>=20 >=20 >=20> Yahoo! Mail
> __________________________________
>=20
--=20
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Jun 14 2005 - 08:08:02 CDT
![]() |
![]() |