Thanks for you reply.
Yes i'm using the latest version. I have now the following (please note that the object 'video' i referred to in my first post is in the snippet a 'node':
IPredicateExpression filter = new PredicateExpression();
IEntityField orderField = NodePropertiesFields.PropertyId.SetAggregateFunction(AggregateFunction.Count);
ISortClause clause = new SortClause(orderField, SortOperator.Descending);
clause.EmitAliasForExpressionAggregateField = false;
sort.Add(clause);
NodeCollection nodes = new NodeCollection();
nodes.GetMulti(filter, 0, sort);
this generates the following SQL:
SELECT TOP (100) PERCENT id AS F4_0, nodeTypeID AS F4_1, title AS F4_2, friendlyURL AS F4_3, featured AS F4_4
FROM dbo.node
ORDER BY COUNT(dbo.node_properties.propertyID) DESC
and that throws the following exception:
The multi-part identifier "dbo.node_properties.propertyID" could not be bound.
somehow i have to construct a subquery with a select and a WHERE part but i don't know how to do this. Any help would be appreciated