Combo wrote:
I'm a newbie to this poweful tool and can't figure out how to get this select query working:
SELECT * FROM Table1
WHERE Table1.ExtrasID Not In (SELECT ExtrasID FROM Table2)
And Table1.ModelRangeID = 5
Any hints? Is typed views the way to go?
For selfservicing, use:
// Selfservicing:
IPredicateExpression filter = new PredicateExpression();
filter.Add(new FieldCompareSetPredicate(
EntityFieldFactory.Create(Table1FieldIndex.ExtrasID),
EntityFieldFactory.Create(Table2FIeldIndex.ExtrasID),
SetOperator.In, null, true));
filter.AddWithAnd(PredicateFactory.CompareValue(Table1FieldIndex.ModelRangeID,
ComparisonOperator.Equal, 5));
Table1Collection results = new Table1Collection();
results.GetMulti(filter);
for Adapter, use:
// Adapter:
IRelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(new FieldCompareSetPredicate(
EntityFieldFactory.Create(Table1FieldIndex.ExtrasID), null,
EntityFieldFactory.Create(Table2FIeldIndex.ExtrasID), null,
SetOperator.In, null, true));
filter.PredicateExpression.AddWithAnd(PredicateFactory.CompareValue(Table1FieldIndex.ModelRangeID,
ComparisonOperator.Equal, 5));
EntityCollection results = new EntityCollection(new Table1EntityFactory());
DataAccessAdapter adapter = new DataAccessAdapter();
adapter.FetchEntityCollection(results, filter);
That should do it