Skip to Main Content

Oracle Database Discussions

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 do division in a query on a row by row basis?

Guess2Mar 27 2008 — edited Mar 27 2008
I have two queries and I want to divide the results by each other on a row by row basis.

select location,count(*)
from mytable
where mycol1 is null

select location,count(*)
from mytable
where mycol1 is not null

I want to divide each location in each query, by each other. and if none come back on one query, I want to null value the output (so the denominator would null value to 1 and the numerator would nvl to 0)

how do I do this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 24 2008
Added on Mar 27 2008
1 comment
629 views