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 query for division of two columns

User_UMJZ5Jun 4 2016 — edited Jun 5 2016

Hi All,

I have table like below but i need to calculate divison of two columns based on group by deptno,locationid,pid,sid.But here i have different empids.I need output mentioned below.

TableName:

      

EmpidDeptnolocationidpidsidValue
130201050200
230201050453
330204060741
430204060147

Need sql qury for below output:In my calculation im considering group by deptno,locationid,pid,sid.But i need to take empid 2 value divided by empid 1(453/200=2.2)value for corresponding group by columns and for some another different group set combination i need to take empid 4 value divided byempid 3 value f(147/741=0.19)for division formula calculation.Below i just given result value as just for forumula purpose.

     

DeptnolocationidpidsidResult
30201050453/200
30204060147/741

Any one can help me on sql query for the above output..

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 3 2016
Added on Jun 4 2016
13 comments
4,514 views