randombits
randombits

Reputation: 48440

Retrieve unique results with Core Data, NSPredicate?

I need to be able to do the equivalent of the following SQL using Core Data:

SELECT DISTINCT(foo) FROM bar

Is there a way of doing this with NSPredicate? Or any other way for that matter?

Upvotes: 1

Views: 381

Answers (1)

wgpubs
wgpubs

Reputation: 8261

I believe all you need to do is add this to your NSFetchRequest

[request setReturnsDistinctResults:YES];

Upvotes: 1

Related Questions