-119 A COLUMN OR EXPRESSION IN A HAVING CLAUSE IS NOT VALID

Explanation

A column or expression identified in a HAVING clause, possibly within a scalar function, does not appear in the GROUP BY clause. Columns or expressions specified in a HAVING clause must appear within aggregate functions or also be specified in the GROUP BY clause.

Start of changeGrouping expressions can be used in a SELECT list or in a search condition in a HAVING clause. A grouping expression specifies only one value for each group. A grouping expression specified in this context must exactly match a grouping expression specified in the GROUP BY clause, with the exception of blanks, which are not significant. End of change

Start of changeThis message is also issued when an expression starting with GROUPING is specified in a SELECT clause, and a GROUP BY clause is not specified. End of change

System action

The statement cannot be processed.

Programmer response

The implied function is not supported by Db2.

SQLSTATE

42803