Is it possible use nested SUBQUERY in NSPredicate?

你离开我真会死。 提交于 2019-12-10 13:15:15

问题


As you can see I have two one-many relationships. Is it possible to write such a nested SUBQUERY where I want to select all A, where any of the belonging C-s under any of belonging B to A satisfy a certain condition?


回答1:


You can nest SUBQUERY in a predicate. But it seems that a single SUBQUERY is sufficient here (if ds is a to-one relationship from C to D), for example

[NSPredicate predicateWithFormat:@"SUBQUERY(bs, $x, ANY $x.cs.ds.name = %@).@count > 0", name];


来源:https://stackoverflow.com/questions/13224601/is-it-possible-use-nested-subquery-in-nspredicate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!