Question
Not contained in either aggregate function or GROUP BY clause
Hi there,
I tried using the script below in the JS activity, but I encountered the error: 'it is not contained in either aggregate function or GROUP BY clause.' I am now attempting to use a subquery and will update you on the progress. Please can you let me know if it can be achievable without using subquery.
var fquery = xtk.queryDef.create
(
<queryDef schema = {vars.targetSchema} operation = "select" >
<select>
<node expr="Substring(@segmentCode,'_',1)" alias="SegmentCode"/>
<node expr="Sum(Case(When(@segmentCode LIKE '%_IS_DELETED', 1), Else(0)))" alias="@IS_DELETED"/>
</select>
<groupBy>
<node expr="Substring(@segmentCode,'_',1)"/>
</groupBy>
</queryDef>
);
var itemsXMLF = fquery.ExecuteQuery(); // DOMElement
var itemsXMLFStr2 = itemsXMLF.toString();
vars.itemsXMLFString2 = itemsXMLF.toXMLString();
//logInfo("itemsXMLF = " + itemsXMLF.toString()