Forum Discussion
Key Field Question
An other solution is to insert lading zeros (01a, 02c, 11d).
- George_HepworthAug 19, 2022Silver ContributorAs is always the case, there are multiple approaches to problems.
One is to apply a band-aid to the symptom and move on, hoping other, similar, problems don't pop up.
The other is to identify the root of the problem and correct that, so the symptom goes away.
Choose wisely. - George_HepworthAug 18, 2022Silver Contributor
Actually, this is two tables, in my opinion, not one with this concatenated code field.
The main table (the one-side of the relationship) is the "Master Card."
Each card type is listed here in this table.
Each variation is listed in a related table (the many-side of the relationship).
If a card has one and only one instance, then there are no records for it in the variation table. As you add variations, they are recorded in the variation table with a foreign key reflecting the Card's Primary Key and a sequence letter for it, e.g. "1a". That way, you can join the two tables to get a complete list.
That does leave the problem of a single card being "1" and having no "a" or "b" etc.
You could approach that in two ways. One, accept the fact that the master card is "1", "2", etc. and you'll only see the variation code IF there are actually variations. Two, finesse the original master with the "A" as suggested. I prefer the first option.
- dluhopAug 18, 2022Copper ContributorGeorge, thanks for your help. I appreciate the time you put into this. I will develop my database with your suggestions in mind.