Oracle SQL AS替代?

时间:2016-12-12 23:28:06

标签: sql oracle

通过一些研究我发现Oracle SQL不支持AS,因此,我的声明导致“缺少关键字”

SELECT IP.Company, IP.Copay, P1.Num_Patients
FROM Insurance_Plan IP
JOIN Patient P
    ON IP.Plan_Name = P.Plan_Name
JOIN
    (SELECT Plan_Name, COUNT(*) AS Num_Patients
    FROM Patient
    GROUP BY Plan_Name) AS P1
    ON P.Plan_Name = N.Plan_Name
GROUP BY IP.Company, IP.Copay, P1.Num_Patients
HAVING P1.Num_Patients =
    (SELECT MAX(Num_Patients) FROM
        (SELECT Plan_Name, COUNT(Patient_ID) AS Num_Patients
        FROM Patient
        GROUP BY Pan_Name) P2);

我遇到麻烦的地方是第8行,我有“AS P1”,我不能为我的生活弄清楚我需要纠正什么才能让它运行起来。感谢帮助!

0 个答案:

没有答案