I'm building a Mac OS X application where I'm storing a number of records in core data (i'm also trying in realm), I have a made up example below:
Num | rate | factor |
_______|______|________|
1 | 3.2 | 4 |
2 | 5.5 | 7 |
2 | 2.1 | 2 |
2 | 3.1 | 2 |
3 | 4.5 | 5 |
1 | 2.3 | 4 |
I want to get the first row for each Num
field. So the result should be as below:
Num | rate | factor |
_______|______|________|
1 | 3.2 | 4 |
2 | 5.5 | 7 |
3 | 4.5 | 5 |
What is the most efficient way to do the above fetch? I have read the following on this:
The unique attributes of Core Data in iOS and Mac OS
https://realm.io/docs/swift/latest/
A simple use case would be as in Messages (for Mac) where it shows the latest message on the left side and the phone number associated with it. It simply does a group by on the number and gets the latest one. How can I achieve this? I have id
field which would be the latest one.