I am having trouble creating code that will sort a collection based on a aggregate field in a child collection.
Basically i want the sql to end up something like this.
select parent.field1, parent.field2
from parent inner join child on parent.field1=child.field1
group by parent.field1, parent.field2
order by Sum(child.field2) ASC
I can't seem to get the SUM part working. This is what I've come up with so far
sorter.Add(new SortClause((DALHelper.ChildFields.field2.SetAggregateFunction(AggregateFunction.Sum)),null, llbl.SortOperator.Ascending));
Your help and wisdom is anxiously awaited.