Re: How do I write a fetch request that will get the entity with the max value?
Re: How do I write a fetch request that will get the entity with the max value?
- Subject: Re: How do I write a fetch request that will get the entity with the max value?
- From: Scott Ellsworth <email@hidden>
- Date: Mon, 1 Aug 2005 18:59:19 -0700
On Aug 1, 2005, at 5:42 PM, Scott Ellsworth wrote:
Hi, all.
My World entity has pop and tech int16 attributes. I want to find
the Entity with the largest value of pop+tech/3.
Once again, it appears that the parser for Core Data's SQL store is
quite amazingly limited, at least compared to other stores and to
what the sqlite3 engine is capable of.
If you build the predicate in code, rather than with the builder, you
avoid the error:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"max(pop +
tech/3) == pop + tech/3"];
but at runtime, you get an unsupported expression type (4).
For what it is worth, this query executes quite well at the sqlite3
command line, even with tens of thousands of elements.
Even something as simple as:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"max(pop +
tech) - pop - tech == 0"];
dies. Sigh.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden