0

如何将 sql 查询转换为谓词或获取请求,

select a.name 
from a 
group by a.name;
4

1 回答 1

1

这是一个可能的解决方案:

NSFetchRequest* request = [NSFetchRequest fetchRequestWithEntityName:@"a"];
[request setPropertiesToFetch:@[@"name"]];
[request setPropertiesToGroupBy:@[@"name"]];
[request setResultType:NSDictionaryResultType];
于 2013-02-19T10:57:04.260 回答