I'm attempting to find an object that has a maximum value in the data store. In sql, the query would be something like this:

select * from foo where value = select max(value) from foo.

Actually, I would be thrilled if I could just get select max(value) from foo.

I've read through the Core Data and Predicates pdfs, and there is a mention of a "max" function in the "BNF Definition of Cocoa Predicates" of the Predicates document, but I've had no luck. My current attempt is to create a fetch request in the XCode Data Modeler using the predicate:

id == max:(
    id
)

When I try to execute this, I get this error:

Unable to generate SQL for predicate (id == max:(
    $FETCHED_PROPERTY.id
)) (problem on RHS)

I'm currently using Sqlite as the backing store.

Does anyone have any suggestions on how to do this? Is this even possible? What I'm trying to accomplish is to maintain ids across multiple persistent stores that can weakly linked as fetched properties.


- Fred McCann
[EMAIL PROTECTED]


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to