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:
Empid | Deptno | locationid | pid | sid | Value |
1 | 30 | 20 | 10 | 50 | 200 |
2 | 30 | 20 | 10 | 50 | 453 |
3 | 30 | 20 | 40 | 60 | 741 |
4 | 30 | 20 | 40 | 60 | 147 |
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.
Deptno | locationid | pid | sid | Result |
30 | 20 | 10 | 50 | 453/200 |
30 | 20 | 40 | 60 | 147/741 |
Any one can help me on sql query for the above output..