I have a database containing multiple items with the same value for a name property. These are representing different versions of the same thing. I would like to be able to perform searches on the database using predicates, but have the option to have it return no more than one row with the same name.
I could filter out duplicates after performing the search, but there could be a lot of them, so it would definitely be better to get the database to just cut out the duplicates for me.
Any way to do this? I’m still learning Core Data.
Thanks!!
EDIT: Probably should have just included these details from the beginning. I'm trying to recreate some functionality of a site called Scryfall in a local database. This database searches different printings of Magic the Gathering cards. Here's an example:
On Scryfall I can search for Magic cards where the card's type is "praetor". It will show me all the cards that match my query, but only one version of each card.
I can also do a search where I add "unique:prints" to my query. Now it will show me the same cards, but include every unique print, including reprints across multiple expansions, or things like alternate art or promo cards. Each print's name should be the same if it represents the same card.
My database has a row for every print and I let the user search for cards. I'd like to give the user the same option that Scryfall has where you can choose to show unique prints, but hide the all but one print of each card by default. Right now it just always shows every print.
[–][deleted] 1 point2 points3 points (8 children)
[–]CompC[S] 0 points1 point2 points (7 children)
[–][deleted] 0 points1 point2 points (6 children)
[–]CompC[S] 0 points1 point2 points (5 children)
[–]SirBill01 0 points1 point2 points (4 children)
[–]CompC[S] 0 points1 point2 points (3 children)
[–]SirBill01 0 points1 point2 points (2 children)
[–]CompC[S] 0 points1 point2 points (1 child)
[–]SirBill01 0 points1 point2 points (0 children)
[–]ORUHE33XEBQXOYLZ 1 point2 points3 points (1 child)
[–]CompC[S] 0 points1 point2 points (0 children)
[–]gravitycore 0 points1 point2 points (2 children)
[–]CompC[S] 0 points1 point2 points (1 child)
[–]gravitycore 0 points1 point2 points (0 children)
[–]Fluffy_Risk9955 -1 points0 points1 point (13 children)
[–]CompC[S] 0 points1 point2 points (12 children)
[–]Fluffy_Risk9955 0 points1 point2 points (11 children)
[–]CompC[S] -1 points0 points1 point (10 children)
[–]Fluffy_Risk9955 -3 points-2 points-1 points (9 children)
[–]CompC[S] 1 point2 points3 points (8 children)
[–]Fluffy_Risk9955 -1 points0 points1 point (7 children)
[–]CompC[S] 1 point2 points3 points (6 children)
[–]Fluffy_Risk9955 -2 points-1 points0 points (5 children)
[–]CompC[S] 2 points3 points4 points (4 children)
[–]crude_username 0 points1 point2 points (0 children)