jetboy

msg:3714738 | 1:27 pm on Aug 4, 2008 (gmt 0) |
Assuming that each parent (I'm assuming categories) can have multiple children (articles), then you're talking about a many-to-many relationship. You'll need to introduce a new table to manage that relationship, which will only contain references to the IDs of your categories and articles. category ------------ category_id category_name ------------ content ------------ content_id content_title content_body ------------ category_content_relationship ------------ category_id content_id ------------ Now, any category can have a relationship with any content.
|
scraptoft

msg:3714764 | 2:10 pm on Aug 4, 2008 (gmt 0) |
I am struggling to get my head around how you would implement the category_content_relationship. Could you give me a demo query? Thanks Jetboy
|
LifeinAsia

msg:3714838 | 3:35 pm on Aug 4, 2008 (gmt 0) |
SELECT category_ID WHERE content_id=ThisCountentID This will return all the "Parent IDs" for the article with content_id of ThesContentID, which is the result you are looking for.
|
phranque

msg:3715411 | 7:01 am on Aug 5, 2008 (gmt 0) |
i think you want something like this: CONTENT ------------ ID ... PARENT_CONTENT ------------ PARENT_ID CONTENT_ID select CONTENT.* from PARENT_CONTENT,CONTENT where PARENT_CONTENT.CONTENT_ID=CONTENT.ID and PARENT_ID=8
|
|