Thanks for the link.
I'm still stock how to do it using Dynamic Relation and Derived Tables. On my query, I need to join 2 fields to the derived table, but when I create instance of the DynamicRelation, it only accept one IPredicate. Also I want to ask if this join clause will be supported on Oracle 8i which doesn't support ansi-join.
Here's the code that I created.
ResultsetFields fields = new ResultsetFields(2);
fields.DefineField(SomeTableFields.Column1, 0);
fields.DefineField(SomeTableFields.Column2, 1, "Column2", AggregateFunction.Max);
GroupByCollection groupBy = new GroupByCollection(fields[0]);
IPredicateExpression filter = new PredicateExpression(SomeTableFields.Column1 == <somevalue>);
DerivedTableDefinition deriveTable = new DerivedTableDefinition(fields, "a", filter, groupBy, <im stock in here>);
RelationPredicateBucket filter2 = new RelationPredicateBucket();
filter2.Relations.Add(relation);
filter2.SelectListAlias = "b";
filter2.PredicateExpression.Add(new EntityField2("Column1", "a", typeof(int)) == new EntityField2("Column1", "b", typeof(int)));
filter2.PredicateExpression.Add(new EntityField2("Column2", "a", typeof(int)) == new EntityField2("Column2", "b", typeof(int)));
EntityCollection<SomeTableEntity> results = new EntityCollection<SomeTableEntity>();
adapter.FetchEntityCollection(results , filter2);
return results;
SELECT a.*
FROM sometable a,
(
SELECT column1,
MAX(column2) as column2
FROM sometable
WHERE column1 = <somevalue>
GROUP BY column1
) b
WHERE a.column1 = b.column1
AND a.column2 = b.column2
LLBLGen 2.6
DotNet 2.0
Oracle 8i