|
Home > Archive > Oracle certifications > December 2001 > Oracle Query!!!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| anjali_deep 2001-12-20, 11:08 pm |
| hi,
I have one query
I want to total number of rows present in two or n table,mind well the out put shud be a single line with the number.
Anjali | |
| laloca 2001-12-21, 12:38 pm |
| Hi Anjali,
You can solve your problem with a query using inline views like this (but it's not really "performant"):
SQL> select
a.agent_count +
c.call_count "AllRows"
from (select count(*) agent_count
from agent_info) a,
(select count(*) call_count
from call_info) c;
AllRows
---------
456919
SQL> select count(*) from agent_info;
COUNT(*)
---------
264027
SQL> select count(*) from call_info;
COUNT(*)
---------
192892
But it works!  | |
| anjali_deep 2001-12-22, 4:19 am |
| hi laloca,
Thnx for the answer,I found out one more way to solve the problem.
select count(*) from (select * from ATABLE
union all
select * from Btable);
And this too works...here u can add n number of tables.
Thnx
Anjali | |
| mainman 2001-12-28, 8:09 am |
| Hi Anjali
I'm not sure but I think your solution requires ATABLE and BTABLE to have same structure, an alternative (which also uses less space is
select count(*) from (select 'x' from ATABLE
union all
select 'x' from Btable);
this should also be faster.
 |
|
|
|
|