MySQL Forums
Forum List  »  Newbie

select from category and any sub category
Posted by: B R
Date: June 17, 2023 06:17PM

I have a simple catalogue running. Products are inside basic high level categories.. I select items from this based on this ID.

For example: SELECT * FROM products WHERE cateogryId = ?

However, I’ve now been asked to add sub categories.

So, if I had Cars before, I now have Cars > Toyota > 4WD

Cars: 2
Toyota: 34 (Parent 2)
4WD: 23 (Parent 34)

Now when I select ID 2, I want to also select those within 34 & 23..

How can I do this?

Options: ReplyQuote


Subject
Written By
Posted
select from category and any sub category
B R
June 17, 2023 06:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.