M
MCB
I have tblCategories, which was related 1:M to tblSubcategories. So, for
example:
- Category 1 had Subcategories A, B, and C
- Category 2 had Subcategories D, E, and F.
However, the tables have been updated, and now need to reflect a M:M
relationship:
- Category 1 has Subcategories A, B, and C
- Category 2 has Subcategories B, D and F
- Category 3 has Subcategories C, E and G.
I read a number of posts on M:M relationships and junction tables and
whatnot, but I'm just not getting it. Where do I record all the other
categories a subcategory relates to past the first one? I.e. the
Subcategories table looks like this:
SubcategoryID (PK) SubcategoryName CategoryID (FK)
--------------------------------------------------------------
1 Subcat 1 1
2 Subcat 2 2
3 Subcat 3 3
but what I need is:
SubcategoryID (PK) SubcategoryName CategoryID (FK)
--------------------------------------------------------------
1 Subcat 1 1, 2, 3
2 Subcat 2 2, 4, 6
3 Subcat 3 3, 5, 7
and I can't add more than one CategoryID to each field. I don't understand
how a junction table would fix that, either.
Help?
example:
- Category 1 had Subcategories A, B, and C
- Category 2 had Subcategories D, E, and F.
However, the tables have been updated, and now need to reflect a M:M
relationship:
- Category 1 has Subcategories A, B, and C
- Category 2 has Subcategories B, D and F
- Category 3 has Subcategories C, E and G.
I read a number of posts on M:M relationships and junction tables and
whatnot, but I'm just not getting it. Where do I record all the other
categories a subcategory relates to past the first one? I.e. the
Subcategories table looks like this:
SubcategoryID (PK) SubcategoryName CategoryID (FK)
--------------------------------------------------------------
1 Subcat 1 1
2 Subcat 2 2
3 Subcat 3 3
but what I need is:
SubcategoryID (PK) SubcategoryName CategoryID (FK)
--------------------------------------------------------------
1 Subcat 1 1, 2, 3
2 Subcat 2 2, 4, 6
3 Subcat 3 3, 5, 7
and I can't add more than one CategoryID to each field. I don't understand
how a junction table would fix that, either.
Help?