Iphone 相当于SQL查询的NSPredicate格式

Iphone 相当于SQL查询的NSPredicate格式,iphone,objective-c,ios,core-data,nspredicate,Iphone,Objective C,Ios,Core Data,Nspredicate,我有两张桌子:表一和表二。与以下SQL查询等效的NSPredicate格式是什么 SELECT * FROM table1 where table1.a NOT IN (SELECT table2.b from table2) 你可以从表2中得到一个b值的列表,然后像这样做 [NSPredicate predicateWithFormat:@"NOT (a in %@)", listOfBValues]; 谢谢Simon,但请查看我的查询,其中我需要表1中的值列表,其中属性“a”未显示在表2

我有两张桌子:表一和表二。与以下SQL查询等效的
NSPredicate
格式是什么

SELECT * FROM table1 where table1.a NOT IN (SELECT table2.b from table2)

你可以从表2中得到一个b值的列表,然后像这样做

[NSPredicate predicateWithFormat:@"NOT (a in %@)", listOfBValues];

谢谢Simon,但请查看我的查询,其中我需要表1中的值列表,其中属性“a”未显示在表2中的值列表中。NSPredicate中如何合作???@Rajesh Simon解决了这一问题。您需要首先获取表.b的所有
值,然后将其中的值替换为
NSPredicate
。核心数据不是数据库。不能将任意SQL转换为核心数据获取请求。去把文档再读几遍。在那之前,你会感到困惑。