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 736955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:39:52+00:00 2026-05-14T07:39:52+00:00

I have three entities: EntityA, EntityB and EntityC connected with to-many relationships. See schema

  • 0

I have three entities: EntityA, EntityB and EntityC connected with to-many relationships.

See schema for details:

alt text http://img706.imageshack.us/img706/9974/screenshot20091220at124.png

For getting all instance of EntityA which depend from EntityB.name I use the predicate like this:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY EntityB.name like 'SomeName'"];

What should be predicate for getting all instance of EntityA which depend from EntityC.name?
I tried query like @"ANY EntityB.entitiesC.name like 'SomeName'" but get exception "multiple to-many keys not allowed here".

Best regards,

Victor

  • 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-14T07:39:52+00:00Added an answer on May 14, 2026 at 7:39 am

    My final solution is to use SUBQUERY.

    NSPredicate *p = [NSpredicate predicateWithFormat:@"(name like %@) AND (0 != SUBQUERY(entitiesB, $x, (0 != SUBQUERY($x.entitiesC, $y, $y.name like %@).@count)).@count)", nameA, nameC];
    

    Unfortunately I was unable to expand this query on nsExpression objects.

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

Sidebar

Related Questions

I have a case where i have three entities with one-to-many and one-to-many relationships:
I have three entities: Country, State and City with the following relationships: When creating
I have three entities, ChannelEntity -> MatchChannelEntity <- MatchEntity, the MatchChannelEntity saves the many
I have three entities as follows: public class EntityA { private Long id; //Getters
I have three entities: User, Office and PhoneNumber. The user has many phone numbers,
I have three entities: Recipe , RecipeIngredient and Ingredient . Each Recipe has many
I have three entities. Author Newspaper Dissertation Newspaper and Dissertation both can have one
I have 2 Entities, related by a many-to-many relationship. Thing<<->>Tag There is one NSArrayController
Have three classes User, Group and Field. Many to many relationship on User /
I have three entities: User , Team , and TeamInvite . Each User has

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.