Please see image below: To get the ID's of Mazda's parent categories I would use the following:
SELECT `parent_id` FROM `product_categories` WHERE `category_id` = 8
if result is not equal to 0 repeat select statement
Is it considered bad practice to loop a SQL select statement until a condition is met? In other words; should I redesign the product categories table?
Many thanks for your advice.