DB2 - Problem description
Problem IT20421 | Status: Closed |
SQL0901N MAY OCCUR WHEN THE SAME TABLE OR VIEW IS USED AS INPUT TO TWO OR MORE GROUP BY OPERATIONS WITHIN THE QUERY. | |
product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
Problem description: | |
The situation can occur under certain condition when the same table or view is used as input to two or more GROUP BY operations within the query - Some subset of the expressions within the GROUP BY clause contain common elements. - For any expressions that are not common between between the multiple group by clauses, those expression reference only constants / parameters markers / host variables or contain columns which are also referenced in predicates which are equal to constants / parameter markers / host variables / etc. For example SELECT * FROM t1 LEFT JOIN ( SELECT d1, sum(d2), sum(d3), substring(d5, 1, 4, CODEUNITS32) FROM t2 WHERE d5 = '2016' GROUP BY d1, substring(d5, 1, 4, CODEUNITS32) ) as t2(d1, sd2, sd3, ss) ON c1 = t2.d1 LEFT JOIN ( SELECT d1, sum(d3), d5 FROM t2 WHERE d5 between '2016' and '2016' GROUP BY d1, d5 ) as t3(e1, se3, e5) ON c1 = t3.e1; | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to Db2 10.5 Fix Pack 9 or higher * **************************************************************** | |
Local Fix: | |
Eliminate the function from the GROUP BY clause since it is a fixed value and does not contribute to the aggregation properties. | |
Solution | |
First fixed in Db2 10.5 Fix Pack 9 | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 02.05.2017 29.09.2017 29.09.2017 |
Problem solved at the following versions (IBM BugInfos) | |
9.0. | |
Problem solved according to the fixlist(s) of the following version(s) |