Retrieving Values for One or More Relationships Using NSPredicate
1 answer
I think you need SUBQUERY here:
[NSPredicate predicateWithFormat:@"SUBQUERY(employees, $e, $e.joinDate >= %@ AND $e.jointDate >= %@).@count > 0",
fromDate, toDate]
employees
is the many relationship from department to employee.
(See ForSubquery: usingIteratorVariable: predicate: in the NSExpression Class Reference, where a similar problem and SUBQUERY solution is documented).
+3
source to share