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

The Archive Base Latest Questions

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

To simplify: There are 3 columns in a table named cards. id packTitle term

  • 0

To simplify:
There are 3 columns in a table named cards.

id packTitle term

id is a column – integers from 0…..100

packTitle – string describing packs, lets say there are 3 kinds of pack PACK1, PACK2, PACK3

term – different unsorted names of 101 items.

by SQL statement

select packTitle from cards group by packTitle;

I can get list of 3 items.

Could you suggest NSPredicate equivalent of SQL statement GROUP BY. I need to get an array to populate in UITableView.

  • 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:24:47+00:00Added an answer on May 24, 2026 at 3:24 am

    CoreData is an object graph management framework, not a SQL data store. Thus, you should—as quickly as possible—get yourself out of the SQL mindset. NSPredicate is intended as a—no surprise—predicate for qualifying objects in the object graph. Thus you can fetch all the objects that match a query, but that is not the same as grouping those results. If you want to do aggregate operations, use Key-Value coding’s collection operators. Under the hood, Core Data may convert these to sensible SQL, but that’s exclusively an implementation detail.

    In this case, you can get the set of unique packTitle values with

    [myCards valueForKeyPath:@"@distinctUnionOfObjects.packTitle"];
    

    which will give you the distinct set of packTitle values in the myCards collection. If you want this for all cards in the Core Data stores, you will have to run a query for all cards, then apply this collection operation.

    The alternative is to make a PackInformation entity, or some such which contains a title property. You can then have only 3 of these entities in the data store, referencing them from the appropriate pack entities. It’s trivial to fetch all three (or whatever the final number is) and get their titles.

    As others have said, if what you’re trying to do is fundamentally reporting from a relational data set, you may better off going with straight SQLite. It all depends on how much other benefit you get from Core Data.

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

Sidebar

Related Questions

Are there any free tools to help simplify working with an NHibernate project in
I'll simplify the problem as much as possible: I have an oracle table: row_priority,
So, to simplify my life I want to be able to append from 1
I am writing an immutable DOM tree in Java, to simplify access from multiple
I want to simplify my execution of a Groovy script that makes calls to
I'm working on a tool to simplify an application's deployment. Hence I'm aiming to
I'm faced with writing a framework to simplify working with a large and complex
I have found jQuery to be a great tool to simplify my MVC Views.
I heard a lot about makefiles and how they simplify the compilation process. I'm
I have a scenario in a system which I've tried to simplify as best

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.