Reputation: 20248
I have Father Entity. Father has a one-to-many relationship with Child. Child has attributes and one of them is name.
I want to perform a fetch request to get: Father.name = "Joe" and out of the fathers named joe I want to fetch those that have a child named Ken: Child.name = "Ken"
So my main objective is to find Ken whose father's name is Joe.
I tried some compound predicates and other things but not luck yet.
Any idea how I can solve this?
thank you
Upvotes: 3
Views: 3080
Reputation: 2759
Assuming you want the child:
[NSPredicate predicateWithFormat:@"father.name = %@ AND name = %@", @"Joe", @"Ken"]
should work
Upvotes: 6