user4951
user4951

Reputation: 33090

Creating Predicate in To-Many Relationship

Say some Business can belong to several districts (given that different people call the same place differently).

Say I want to find businesses whose one of the district contain @"Mangga"

So Business have relationship called Districts to a bunch of District entity and each District contains an attribute called name

How would I do so?

Upvotes: 0

Views: 520

Answers (1)

Dave DeLong
Dave DeLong

Reputation: 243156

You'll need the ANY keyword:

NSPredicate *p = [NSPredicate predicateWithFormat:@"ANY districts.name = 'Mangga'"];

Upvotes: 2

Related Questions