Hi I 'd like some help please. I have 3 tables
**Products**
product_id //eg 1
product_name //eg apple imac
description // mplah mplah
category_id // 3 - desktops
...
**Features**
feature_id // 1
feature_name // processor
category_id // takes the parent-category eg computers with id = 1
and a pivot table **product_features** that should have something like this
product_id // 1
feature_id // 1
feature_value // intel i5
Each table also represents a model (so i have a product_model, feature_model and a product_feature_model -which i'm not sure yet if its needed-)
In my view I have a form in which i do inserting/editing, in which I want to fetch all the features of the specific category (in my example 'computers') and the values that also belong to the specific product.
So I should get something like apple imac - processor - intel i5, nikon - zoom - 12Mpx
How can I make this query and in which model is it better to put into??
Here's the query i've tested in phpmyadmin
SELECT `features`.*, `product_features`.`value`
FROM (`features`)
LEFT JOIN `product_features` ON `features`.`feature_id`=`product_features`.`feature_id`
WHERE `features`.`category_id` = 1
WHERE `product`.`product_id` = 1 // without this, it returns feature_id, feature_name, category_id and feature_value collumns, but I also want to specify from wich product