0

i want fetch request for below query

select name,count(1) from tablename groupedby name;

i tried to add grouped by fetch controller not succeed how to do that

Shabeer
  • 23
  • 5

1 Answers1

1

AFAIK, you can't have group by query in MR without FRC. So may be you need something like:

+ (NSFetchedResultsController *) MR_fetchAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm groupBy:(NSString *)groupingKeyPath delegate:(id<NSFetchedResultsControllerDelegate>)delegate;;

If you still need just query, you can take a look a this solution

Nikita Took
  • 3,980
  • 25
  • 33