Core Data: Multiple conditions inside relational aggregate operations
- by Uzaak
I have an SQLite table used by Core Data with the following elements:
Name: John
LastName: Foobar
Age: 23
Name: Bob
LastName: Baz
Age: 37
Name: Peter
LastName: Fooqux
Age: 32
Name: John
LastName: Bar
Age: 29
Those are all in a to-many relationship from another object "Company". I need to query the database and retrieve all Company objects with employees called "John" but whose last name does NOT contain "Foo".
I did go as far as to make the following predicate:
[NSPredicate predicateWithFormat:@"ANY employee.name = 'John'"];
How do I get to filter only by companies whose Johns don't have "Foo" in their last names?