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

  • SEARCH
  • Home
  • 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 6857685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:03:28+00:00 2026-05-27T02:03:28+00:00

In a database I have a following situation, A has many B ‘s and

  • 0

In a database I have a following situation, A has many B‘s and C also has many B‘s.
What is the effective way of using Core Data relationships to search for this type of query?

  1. I need to search on both a.x and c.y attributes
  2. then I need those B‘s which are common to both

For example:

records are separated by colon (";"), and attributes by comma (",")

A = {a;b}
C = {m;n}
B = {1,a,m;2,a,n;3,a,n;4,b,m;5,b,m;6,a,m;7,b,n;8,b,n}

Will the queries c.x = m and a.y = a result in following records from B = {1;6}?

  • 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-27T02:03:29+00:00Added an answer on May 27, 2026 at 2:03 am

    Technical note: Core Data isn’t a relational database, so doesn’t really have ‘joins’. It’s more accurately described as an object graph.

    It should be quite straightforward to implement what you want:

    Set up a model with entities A, B, C.

    B has a ‘to-many’ relationship to A (this property called a), and a ‘to-many’ relationship to C (this property called c).

    Populate this model with data as appropriate.

    Then to get your ‘join’, search using a predicate as follows:

    NSFetchRequest* fetchRequest = [[NSFetchRequest alloc] init];
    
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"B" inManagedObjectContext:del.managedObjectContext];
    [fetchRequest setEntity:entity];
    
    NSString* predicateString = [NSString stringWithFormat:@"a.x = %@ AND b.y = %@", 
                            @"something1", @"something2"];
    
    fetchRequest.predicate = [NSPredicate predicateWithFormat:predicateString];
    
    NSError *error = nil;
    NSArray* objects = [del.managedObjectContext executeFetchRequest:fetchRequest error:&error];
    

    See also iPhone CoreData join.

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

Sidebar

Related Questions

I have following data to save in database using php my data is :
We've encountered the following situation in our database. We have table 'A' and table
I have the following tables in my database that have a many-to-many relationship, which
I am using the SQLite database and have the following persistent class (simplified): public
I have the following problem in a Database using Access 2007 as front end
I have the following situation: One Destination can have Many Aliases Logically : I
I have the following situation. I have a database of transactions about multiple contracts.
I have a Database that has the following relations: Transaction->Purchase->Item->Schedule Transaction - self explanitory
So situation is following : We have some very old product, that has dozen
I'm thinking of the best way to design a database given the following situation.

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.