gpt4 book ai didi

查询 "undefined"列 (?) 时出现 SQL 错误

转载 作者:行者123 更新时间:2023-12-04 21:50:01 25 4
gpt4 key购买 nike

   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 输出”处说错误,但我无法弄清楚它有什么问题。 :S

ERROR at line 1:
ORA-00933: SQL command not properly ended

最佳答案

您不需要子选择。这个查询是等价的:

SELECT
Airplane.aname AS name,
AVG(worker.salary) AS avgSalary
FROM Aircraft Airplane
JOIN Certified IsCertified ON Airplane.aid = IsCertified.aid
JOIN Employees worker ON IsCertified.eid = worker.eid
WHERE Airplane.crusingrange > 1000
GROUP BY Airplane.aid, Airplane.aname

关于查询 "undefined"列 (?) 时出现 SQL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9857259/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com