|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Update Query
Hi
I have a query to update the commission of salesmen by 1.5% of the income from all the sales they have been associated with. The query was: UPDATE emp X SET comm = (SELECT SUM(NVL(comm,0))*1.59 FROM emp Y WHERE Y.empno = X.empno GROUP BY Y.empno This isnt working, would this work instead: UPDATE emp e SET comm = (SELECT SUM(NVL(comm,0))*0.015 FROM emp e WHERE e.empno = e.empno GROUP BY e.empno Would the latter work - can anyone advise me on this? |
|
#2
|
|||
|
|||
|
Yes, you are right but last time the query you have quoted in your question, i sent it to someone. that was only a example, and you suppose to modify it.
Question : to update the commission of salesmen by 1.5% of the income from all the sales they have been associated with. according to mathematical principal, 1.5 percent mean 1.5/100 that is equal to 0.015 now your query would be look like that: UPDATE emp e SET comm = (SELECT SUM(NVL(comm,0))*0.015 FROM emp e WHERE e.empno = e.empno GROUP BY e.empno |
|
#3
|
|||
|
|||
|
Thanks so much!
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Update Query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|