1 post in 2 categories
From: <bit-naughty_at_hotmail.com>
Date: Fri, 14 Oct 2016 13:20:47 -0700 (PDT)
Message-ID: <b1594c15-df83-4326-903f-e3b04f3153c6_at_googlegroups.com>
[Quoted] [Quoted] [Quoted] [Quoted] If I have say, a "blog" site with posts on it, I want a table for the posts, it'll have a primary key, post text, date posted etc. Now, *one* particular post can be in 2 categories - say, "gardening" and "vegetables" - obviously I can't have a "Category" field in the DB if 1 post can be in 2 categories. How do I do this? Having a whole separate line in the DB with 2 identical pieces of info, but different Categories, seems absolutely an AWFUL thing to do, and won't work cause they'll be different primary keys *anyway* - so do I just make a whole damn separate table just for "post id" (primary key from the above table), and a "category" field.....? Just so 1 post can be in 2 categories (or more).....? What's the most elegant solution for this?
Date: Fri, 14 Oct 2016 13:20:47 -0700 (PDT)
Message-ID: <b1594c15-df83-4326-903f-e3b04f3153c6_at_googlegroups.com>
[Quoted] [Quoted] [Quoted] [Quoted] If I have say, a "blog" site with posts on it, I want a table for the posts, it'll have a primary key, post text, date posted etc. Now, *one* particular post can be in 2 categories - say, "gardening" and "vegetables" - obviously I can't have a "Category" field in the DB if 1 post can be in 2 categories. How do I do this? Having a whole separate line in the DB with 2 identical pieces of info, but different Categories, seems absolutely an AWFUL thing to do, and won't work cause they'll be different primary keys *anyway* - so do I just make a whole damn separate table just for "post id" (primary key from the above table), and a "category" field.....? Just so 1 post can be in 2 categories (or more).....? What's the most elegant solution for this?
Thanks. Received on Fri Oct 14 2016 - 22:20:47 CEST