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!

SQL Question: Get Ratio Out of Two Rows

aDBAMay 1 2013 — edited May 1 2013
My data in a table looks like below:

ID Name Value
----------- ------------------- ----------------
1 n1 1234
1 n2 2345
2 n1 3456
2 n2 4567
....

I need to get ratio (value of n1)/(value of n2) for each ID. So my results are like

ID Ratio
---------- --------------
1 0.58
2 0.75
.....

I can write PL/SQL to get the results. But I am wondering if a simple SQL can do that too.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 29 2013
Added on May 1 2013
4 comments
903 views