Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to SUM two count(*) values in a single sql tatement?

390534Aug 16 2006 — edited Aug 16 2006
How can I get a single SQL statement to sum two values from a count(*)

I want something like this:
SELECT COUNT(*) FROM MYTABLE
UNION
SELECT COUNT(*) FROM MYOTHERTABLE; 

but instead of getting
111
222

I want to see the sum of the two values.
333
can such a thing be done with one statement. I know I can do stuff inside a BEGIN END and have vars but wonder if there is simple single statement solution.

Thanks in advance,
David Miller
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2006
Added on Aug 16 2006
6 comments
1,742 views