【发布时间】:2014-03-24 06:53:27
【问题描述】:
我是 SQL 新手,遇到了一个查询问题。
我有 3 个表employees、departments 和salary_paid。 我正在尝试通过给出这个条件来更新salary_paid 表中的奖金列
give 10% bonus on total salary to the employees who are not in IT departments.
我想出了这个查询
update salary_paid
set bonus=(select (0.1*total_salary) "Bonus"
from salary_paid, departments, employees
where
employees.department_id=departments.department_id and
employees.employee_id=salary_paid.employee_id and
departments.department_name!='IT')
;
但是它返回这个错误
ORA-01427: 单行子查询返回多于一行
我对此一无所知,请帮忙。 在此先感谢
【问题讨论】: