I'm having trouble with core data and fetching distinct values. What I want to do is fetch records that are distinct by one property, but I want to fetch more than one property of a record. If I set setPropertiesToFetch:[NSArray arrayWithObject:@"firstAtrb", @"secondAtrb"] (more than one) then setReturnsDistinctValues:YES returns distinct values by properties defined in setPropertiesToFetch. Is it possible to define a property by which fetch should be distinct but at the same time define more than one property to fetch?
here is a solution that i used on you can filter the results by distinct heres and example [myResults valueForKeyPath:@"@distinctUnionOfSets.foo"] and a the refrence link retrieving distinct values core data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With