Kbase P184267: Error 7642 using aggregate and non-aggregate expressions in same clause of SQL SELECT statement
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/16/2011 |
|
Status: Unverified
SYMPTOM(s):
Error 7642 using aggregate and non-aggregate expressions in same clause of SQL SELECT statement
Aggregate function not allowed here (7642)
Statement similar to:
SELECT Ordernum, Price / SUM(ExtendedPrice) FROM PUB.OrderLine GROUP BY Ordernum
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
CAUSE:
Aggregate functions are not allowed in the same clause as non-aggregate expressions such as a column name. The result of an aggregate function is based on an entire set of rows specified by the GROUP BY clause, while non-aggregate expressions are based on a single row.
FIX:
Revise the query to place the aggregate function in a subquery, or use a stored procedure to get the results of the aggregate function from a separate query and insert it into the main query.