Master Mainframe Technologies - COBOL, JCL, DB2, VSAM, CICS & More
ABEND Codes SQLCODEs File Status Interview Prep Contact
← Back to SQLCODE Reference
Error

SQLCODE -118

Table in FROM not in GROUP BY

Explanation

A column in SELECT is not in GROUP BY clause and not an aggregate function.

Solution

Add the column to GROUP BY or use an aggregate function (SUM, COUNT, MAX, etc.).

Example

SELECT DEPT, NAME FROM EMP GROUP BY DEPT -- NAME needs GROUP BY or aggregate