2012-11-19 124 views
1
SELECT * FROM (
SELECT SUM(A.Precio)AS "Total gastado", B.email FROM ARTICULO_EVENTO A 
    JOIN (C.email FROM PEDIDO_ARTICULO_EVENTO C)B 
    ON(B.email=A.email) 
WHERE B.FechaHora > TO_DATE('20-08-2012', 'MM-DD-YYYY') 
GROUP BY (B.email) 
ORDER BY SUM(A.Precio) DESC 
) 
WHERE ROWNUM <=5; 

ORA-00907:缺少右括號。在線3.ORA-00907:缺少右括號

¿爲什麼我得到這個錯誤?

回答

2

試試這個,你忘了在一個子查詢中選擇關鍵字,並留下了「;」:

SELECT * FROM (
SELECT SUM(A.Precio)AS "Total gastado", B.email FROM ARTICULO_EVENTO A 
    JOIN (select C.email FROM PEDIDO_ARTICULO_EVENTO C)B 
    ON(B.email=A.email) 
WHERE B.FechaHora > TO_DATE('20-08-2012', 'MM-DD-YYYY') 
GROUP BY (B.email) 
ORDER BY SUM(A.Precio) DESC 
) 
WHERE ROWNUM <=5; 
+0

非常感謝主席先生。 – Nausikaa