谁能向我解释为什么 dLoad 是 GROUP BY 行中的无效标识符?这在 Mysql 上运行良好,但我无法让它与 Oracle 一起使用。
CREATE OR REPLACE VIEW DoctorsLoad AS
SELECT dID, gender, specialty, 'Overloaded' AS dLoad
FROM Doctor D, Examine E
WHERE D.dID = E.doctor_id
GROUP BY dID, gender, specialty, dLoad
HAVING COUNT(*) > 10
UNION
SELECT dID, gender, specialty, 'Underloaded' AS dLoad
FROM Doctor D, Examine E
WHERE D.dID = E.doctor_id
GROUP BY dID, gender, specialty, dLoad
HAVING COUNT(*) <= 10;