UPDATE sql statement help please [message #317637] |
Fri, 02 May 2008 04:54 |
sunildatt_b
Messages: 3 Registered: May 2008
|
Junior Member |
|
|
question
==========
The company has decided to adopt a bonus policy for their employees. Each employee will now receive a bonus of $500 for every project on which they have charged at least 10 hours. As a result, management has asked you to update the employee records to include their current bonus information. In order to accomplish this, you will have to add another attribute to the EMPLOYEE table, this attribute is BONUS_AMT. You will then have to update the value in the bonus amount field for each employee to be equal to $500 multiplied by the number of projects on which they have charged more than 10 hours.
the query i wrote is
=============
update EMPLOYEE E SET e.BONUS_AMT = (select count(*) * 500
from ASSIGNMENT a, EMPLOYEE E where e.emp_num =e.emp_num group by e.emp_num
having SUM(a.HOURS_CHARGED) > 10 )
where e.BONUS_AMT =0
but its showing error like
ora-01427: single row subquery returns more than one row
can you help me to update this employee table
|
|
|