Hi,
you have to use a "relation table", which define ... relations
between objects
your main object table :
product_id name
657 Complete bike, model "Flash"
12534 Tires ref. XJ67
12567 Tires ref. TXA4
then the relation table :
id_father id_son
657 12534
657 12567
which mean that the object "657" has a "relation" (whatever
that mean for you : "part of", "belonging to", etc.) with
objects # 12534 and object # 12567
so when you want "all the objects connected with object 657"
you just do a :
SELECT id_son FROM relation_table WHERE id_father='657';
and if you want to different kind of relation inside the same table
you just add a column specifiing the relation
id_father id_son relation_type
657 12534 12
657 12567 14
where '12' mean "part of" and "14" mean "same category as"
for instance.
so if I just want parts fitting object 657, I do :
SELECT id_son FROM relation_table
WHERE (id_father='657') AND (relation_type='12');
and so on for other relations I need to query.
Hervé.