a tough filterBucket to build

Posts   
 
    
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 31-May-2005 22:14:16   

Greetings,

I need to build a filter bucket that can reterive the following SQL:

 Select * From Stock s
Where (s.strCompanyRef = '6010' And s.dtmDate = '1993-01-04') OR
       (s.strCompanyRef = '6010' And s.dtmDate = (Select Max(s2.dtmDate) From Stock s2 Where s2.dtmDate < '1993-01-04'))

I know how to build expressions but I can't figuer out how to build an expression that has an aggregate as one of its operands!! flushed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 31-May-2005 22:55:55   

Use a FieldCompareExpressionPredicate with a setoperator Equal.

You've to apply the aggregate function to the setfield, which is abit cumbersome (first create the field, then set the aggregate, then pass it to the FieldCompareExpressionPredicate constructor)

Frans Bouma | Lead developer LLBLGen Pro