php - multiple attribute database design -
i have product has many color variants , need design database tables. it's same product not models have same color variants. 1 product has 3 color , other may have 6 colors.
here going. can have price field in both, models
, options
sum in script, way can have different price depending on model , color option.
update
your query somoething like:
select p.name 'product', m.name 'model', m.description 'model_description', o.name 'option' `products` p left join `models` m on (p.id = m.product_id) left join `option_to_model` otm on (m.id = otm.model_id) left join `options` o on (otm.option_id = o.id)
here live example sqlfiddle
Comments
Post a Comment