paul
paul

Reputation: 137

how to translate this sql queries to Core Data

How to convert the sql queries into predicates or fetch requests,

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

Upvotes: 0

Views: 225

Answers (1)

Mark Kryzhanouski
Mark Kryzhanouski

Reputation: 7241

It is a possible solution:

NSFetchRequest* request = [NSFetchRequest fetchRequestWithEntityName:@"a"];
[request setPropertiesToFetch:@[@"name"]];
[request setPropertiesToGroupBy:@[@"name"]];
[request setResultType:NSDictionaryResultType];

Upvotes: 1

Related Questions