advanced select

Posts   
 
    
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 01-May-2008 10:24:45   

Hi all

How can apply this SQL statment in LLBL V 2.5 using adapter

Select sum(B.column1-B.column2) from Table1 as A join Table2 as B on A.column3=B.column3 where A.column4=_parameter_ and B.column5=_parameter_

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-May-2008 10:34:54   

Use adapter.GetScalar() method, Please check the example of Aggregate functions in scalar queries in the manual's section "Using the generated code -> Field expressions and aggregates"

You should use the following overload to specify the predicate and the relation specified.

public virtual object GetScalar( 
   IEntityField2 field,
   IExpression expressionToExecute,
   AggregateFunction aggregateToApply,
   IPredicate filter,
   IGroupByCollection groupByClause,
   IRelationCollection relations
)