Core Data: Multiple conditions inside relational aggregate operations

Posted by Uzaak on Stack Overflow See other posts from Stack Overflow or by Uzaak
Published on 2014-06-02T03:21:26Z Indexed on 2014/06/02 3:24 UTC
Read the original article Hit count: 261

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about ios

Related posts about core-data