Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如您所见,我有两个一对多的关系。是否可以编写这样一个嵌套的子查询,我想选择所有 A,其中任何属于 B 到 A 下的任何属于 C 满足特定条件?
您可以将 SUBQUERY 嵌套在谓词中。但似乎单个 SUBQUERY 在这里就足够了(如果ds是从to的一对一关系),例如CD
ds
C
D
[NSPredicate predicateWithFormat:@"SUBQUERY(bs, $x, ANY $x.cs.ds.name = %@).@count > 0", name];