Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6193201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:04:42+00:00 2026-05-24T03:04:42+00:00

I know how to write the request I need in SQL but can’t find

  • 0

I know how to write the request I need in SQL but can’t find a way to implement it using Core Data, or if I find a solution it would be ugly and messy, using 20+ lines of code…

My request is SELECT MAX(distance) FROM DataTrip WHERE idTrip = (SELECT DISTINCT(idTrip) FROM DataTrip);

Any idea how I can do that using Core Data with NSSortDescriptor, NSPredicate, NSExpressionDescription, etc.?

Thank you!

Update 1

Data model for DataTrip object:

@interface DataTrip : NSManagedObject {
@private
}
@property (nonatomic, retain) NSNumber * speed;
@property (nonatomic, retain) NSNumber * heading;
@property (nonatomic, retain) NSNumber * longitude;
@property (nonatomic, retain) NSNumber * timestamp;
@property (nonatomic, retain) NSNumber * latitude;
// More properties here
@property (nonatomic, retain) NSNumber * idTrip;
@property (nonatomic, retain) NSNumber * distance;

@end

So I would have in my database multiple rows with the same idTrip, and I want the max value for distance for each idTrip.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:04:43+00:00Added an answer on May 24, 2026 at 3:04 am

    The question is difficult to answer because it hinges on the assumption that SQL and Core Data have anything to do with each other. They in fact, have very little to do with each other. Core Data is not a database and should not be thought of as or treated as one. The way you would accomplish the task you specified in the question is highly dependent on the data model that you have created. Without that information it’s not possible to give any more helpful information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that with mysql you can write SQL statements into a .sql file
Is there an easier way to write this? I know if i didnt need
Both have Request and Response properties, but I can't write a method that takes
I know I could write scripts and create jobs to run them, but at
I know how to write the basic c# code to send emails, but I'm
So I know I can write my own HTML-encoding function like this: function getHTMLEncode(t)
I am using a SWFupload script and I can't make a request from flash
I have a solution but it is one that I know is not the
I am trying to find a way, using AFNetworking, to set the Content-Type header
I need to send a GET request to another domain preferably using jQuery. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.