I'm trying to accomplish the following:
SELECT PC.PROJECT_ID, P.NAME, COUNT(PC.CELL_ID) NumberOfCells, COUNT(CC.CELL_ID) NumberOfChanges
FROM PROJECTS P,
PROJECT_CELLS PC,
CELL_CHANGE CC
WHERE P.PROJECT_ID = PC.PROJECT_ID
GROUP BY PC.PROJECT_ID, P.NAME
ORDER BY CELL_NO;
The following code works if I only include the NumberOfCells:
**RelationPredicateBucket bucket = new RelationPredicateBucket();
ResultsetFields dtFields = new ResultsetFields(2);
dtFields.DefineField(ProjectCellsFields.ProjectId, 0);
dtFields.DefineField(new EntityField2("NumberOfCells",
(ProjectCellsFields.CellId * 1), AggregateFunction.Count), 1);
GroupByCollection dtGroupBy = new GroupByCollection(dtFields[0]);
DerivedTableDefinition dtDefinition = new DerivedTableDefinition(dtFields, "CellsCounter", null, dtGroupBy);
DynamicRelation relation = new DynamicRelation(dtDefinition, JoinHint.Inner,
EntityType.ProjectsEntity, "P",
(new EntityField2(ProjectCellsFieldIndex.ProjectId.ToString(), "CellsCounter", typeof(int)) ==
ProjectsFields.ProjectId.SetObjectAlias("P")));
bucket.Relations.Add(relation);
bucket.SelectListAlias = "P";**
Anyone knows how can I modify my code in order to include the other Count (NumberOfChanges )?
Thanks for your help.