DB2 Error Code – -122 a select statement with no group by clause contains a column name or a column function in the select clause or a column name is contained in the select clause but not in the group by clause

In this post, you’ll learn about the error message -122 a select statement with no group by clause contains a column name or a column function in the select clause or a column name is contained in the select clause but not in the group by clause in the IBM DB2 database , the reason why it occurs along with the solution to fix it

IBM DB2 Error Message

-122 a select statement with no group by clause contains a column name or a column function in the select clause or a column name is contained in the select clause but not in the group by clause

Reason for the Error

The SELECT statement contains one of these two types of errors:� *�� The statement contains a column name and a column function in the���� SELECT clause, but no GROUP BY clause.� *�� A column name is contained in the SELECT clause (possibly within a��� scalar function) but not in the GROUP BY clause.

Solution

You can correct the statement by:

Including the columns or expressions in the GROUP BY clause that are in the SELECT clause, or
Removing the columns or expressions from the SELECT clause.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the error message -952 processing was interrupted by a cancel request from a client...
  • DB2
  • November 21, 2022
In this post, you’ll learn about the error message -927 the langrage interface was called when the connecting environment was...
  • DB2
  • November 21, 2022
In this post, you’ll learn about the error message -926 rollback not valid in ims/vs or cics environment in the...
  • DB2
  • November 21, 2022