The 2 column data is read into a datatable using a dyn. list, right? Or are you fetching entities?
if you're fetching a list, do this:
ResultsetFields fields = new ResultSetFields(2);
fields.DefineField(EmployeeTlFieldIndex.EtId, 0, "et_id", "ETl");
fields.DefineField(EmployeeTlFieldIndex.EID, 1, "e_id", "ETl");
FieldCompareRangePredicate compareRangePredicate = new
FieldCompareRangePredicate(EntityFieldFactory.Create(EmployeeTlFieldIndex.EId), null, list);
FieldCompareExpressionPredicate compareExpPredicate = PredicateFactory.CompareExpression(
EmployeeTlFieldIndex.EId,
ComparisonOperator.Equal,
new Expression(EntityFieldFactory.Create(EmployeeTlFieldIndex.EId)),
"ETl"
);
PredicateExpression subSelectPredicate = new PredicateExpression();
subSelectPredicate.Add(compareExpPredicate);
subSelectPredicate.AddWithAnd(PredicateFactory.CompareValue(
EmployeeTlFieldIndex.EtValidFrom, ComparisonOperator.LessEqual, dt));
FieldCompareSetPredicate compareSetPredicate = new FieldCompareSetPredicate(
fields[0], null,
EntityFieldFactory.Create(EmployeeTlFieldIndex.EtId), null,
SetOperator.Equal,
subSelectPredicate,
null,
"ETl",
1,
new SortExpression(SortClauseFactory.Create(EmployeeTlFieldIndex.EtValidFrom, SortOperator.Descending))
);
IRelationPredicateBucket predicateBucket = new RelationPredicateBucket();
predicateBucket.PredicateExpression.Add(compareRangePredicate);
predicateBucket.PredicateExpression.AddWithAnd(compareSetPredicate);
DataTable tlist = new DataTable();
adapter.FetchTypedList(fields, tlist, predicateBucket);
(haven't tested it, this is the idea)
If you're fetching entities, you can alias the subquery field, by setting that field's objectAlias to ETl. Which version is aliased is not important.