SELECT Failed. 3504: Selected non-aggregate values must be part of the associated group in v14.10.05.09 and not in v14.00.07.02

General

SELECT Failed. 3504: Selected non-aggregate values must be part of the associated group in v14.10.05.09 and not in v14.00.07.02

Hi 

There are totally 9 fields in the select clause of the query where 5 are direct fields. two of them are result of select query in the select clause and two more are from the using the result from previous two fields used in case when statments. The SUM aggregate is applied on the last two columns. All the first 5 columns are listed in the group by clause.

Query :

SELECT

sub.a,sub.b,sub.c,Table1.d,Table1.e,

(select x from table t1 where y=current_date) as f, 

(select z from table t1 where y=w) as g,

sum(case when f=g then 1 else 0)) as h,

sum(case when f+1=g then 1 else 0)) as i

FROM Table1

LEFT JOIN

(

SELECT a,b,c,l,m,n,o FROM Table2 INNER JOIN Table3 ON Table2.p=Table3.t

)sub

ON Table1.e = sub.l

GROUP BY sub.a,sub.b,sub.c,Table1.d,Table1.e

The above query which works perfectly fine in Teradata v14.10.05.09 but fails with "SELECT Failed. 3504:  Selected non-aggregate values must be part of the associated group" in Teradata v14.00.07.02. 

Is this because of something introduced in the newer version that is causing the query to fail but run fine in older version?

Or am i missing something?

Thanks in Advance.