SELECT Output.name, Output.avgSalary
FROM (SELECT Airplane.aid, Airplane.aname AS name,
AVG (worker.salary) AS avgSalary
FROM Aircraft Airplane , Certified IsCertified, Employees worker
WHERE Airplane.aid = IsCertified.aid AND
IsCertified.eid = worker.eid AND
Airplane.crusingrange > 1000
GROUP BY Airplane.aid, Airplane.aname) AS Output
Oracle SQL在结尾处的“ AS Output”处显示错误,但我无法弄清楚它出了什么问题。 :S
ERROR at line 1:
ORA-00933: SQL command not properly ended
最佳答案
试试这个:
SELECT Airplane.aid, Airplane.aname AS name,
AVG (worker.salary) AS avgSalary
FROM Aircraft Airplane INNER JOIN Certified IsCertified on
Airplane.aid = IsCertified.aid
INNER JOIN Employees worker on IsCertified.eid = worker.eid
WHERE Airplane.crusingrange > 1000
GROUP BY Airplane.aid, Airplane.aname
关于sql - 查询“未定义”列时出现SQL错误(?),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9857259/