dLoadがGROUPBY行の無効な識別子である理由を誰かに説明してもらえますか?これは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;