所以我试图弄清楚我的教授给我的这个问题,无论我尝试什么,我似乎都无法正确获取代码。员工表有员工信息,比如薪水,而工作表有关于项目小时数的信息我现在的代码是
select e.name
from employee e, workon w
where e.empid = w.empid
and e.name in
(select name
from employee
having salary < avg (salary)
and empid in
(select empid
from workon
having sum (hours) > 100))
group by e.name
问问题
233 次
2 回答
0
试试这个:
SELECT name FROM employee WHERE salary < (SELECT AVG(salary) FROM employee) having sum(hours) > 100 GROUP BY name;
于 2012-11-22T02:44:46.533 回答
0
也许是这样的:
select
e.name
from
employee e
inner join workon wo on e.employee = wo.employee
where
e.salary < (select avg(salary) from employee)
and sum(wo.hours) > 100
group by
e.name;
于 2012-11-22T02:49:49.730 回答