Reputation: 41
Are there any methods to sorting (filtering) result.
For example I have database which contain some information:
alex - 21,
bob - 65,
roy - 37,
alex - 55;
I want to get result like this (like NSMutableArray):
alex - (21, 55),
bob - 65,
roy - 55;
I can do it using loop, but may be it's possible by native instruments?
Thanks.
Upvotes: 0
Views: 52
Reputation: 23359
There is no way to do this, each "object" so, "alex", "bob", "roy" and "alex" are different, so when you fetch a set of objects, it gives you your set, "alex" is different from the other "alex", an easier way to simulate something like this would to have a to-many relationship set between what I assume is a Person entity and an, Age entity ?
If your Alex's are in fact the same person, which thinking of it in the context of my example seems impossible, you could retrieve only 3 objects and for each retrieve another information from it's to-many relationship.
A better example may be a game for which each user has a set of scores, thus grouping a score in a to-many relationship.
Upvotes: 3