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
Post a Comment