ios - CoreData: Get the number of distinct elements -


i want number of distinct elements grouped value can have in coredata. equivalent select count(select price in glasses group price price!=null);

so far tried (i use magical record).

nsfetchrequest *fetchrequest = [glasses fetchrequest]; fetchrequest.predicate = [nspredicate predicatewithformat:@"price!=nil"]; fetchrequest.resulttype = nsdictionaryresulttype; fetchrequest.propertiestogroupby = @[@"price"]; fetchrequest.propertiestofetch = @[@"price"]; nsarray *results = [glasses mr_executefetchrequest:fetchrequest] 

by calling results.count can correct information.

is there way retrieve count without fetching values ?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -