title: Why this code showing invalid use of group function?
body: <pre><code>CREATE VIEW SALESMAN_WITH_MAX_ORDER AS 
      (SELECT S.Salesman_id,
              S.Name,
              S.City,
              Commission 
      FROM SALESMAN S,
           CUSTOMER C 
      WHERE S.Salesman_id=C.Salesman_id 
        AND Customer_id IN (SELECT Customer_id
                            FROM ORDERS
                            GROUP BY Customer_id,
                                     Ord_Date
                             HAVING SUM(PURCHASE_AMT) = (SELECT MAX(SUM(PURCHASE_AMT)) 
                                                         FROM ORDERS
                                                         GROUP BY Customer_id,
                                                                  Ord_Date)));
  </code></pre>