I have three table that are linked like this. Each content is linked to a category and each category is linked to a section. Like this




I want to write a query to display only content from a particular section and I am having difficulty, can someone help me with writing my query? Thank you

Recommended Answers

All 2 Replies

SELECT `contents_table.content_id`, `contents_table.content_title`, `contents_table.content_description`
From `contents_table`, `categories_table`, `selection_table`
WHERE `selection_table.selection_id` = selectedID
AND `selection_table.selection_id` = `categories_table.selection_id`
AND `categories_table.category_id` = `contents_table.category_id`

I think this should do it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.