Reputation: 31
I have one table, 'Person' and another, Car, where the relation is one-to-many (one person may have many cars).
How can a write a predicate to get all persons who have a car (any one if they have more) with a certain property?
Upvotes: 0
Views: 36
Reputation: 4569
Something like this?
NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"Person" inManagedObjectContext:context];
NSString *str = @"ANY cars.property == 'value'";
NSPredicate *predicate = [NSPredicate predicateWithFormat:str];
...
Upvotes: 1