InnovatecInc Posted May 27, 2015 Share Posted May 27, 2015 Hi I am trying to run a SQL query on my database to show all products and their respective features and feature values. This is where I am but as I get the feature but every possible value for that feature - how do I limit it to just the ones used by the product. Sorry for my poor SQL skills. Steve Select pl.name, fl.name From ps_product_lang pl LEFT JOIN ps_feature_product fp ON (pl.id_product = fp.id_product) LEFT JOIN ps_feature_lang fl ON (fp.id_feature = fl.id_feature) LEFT JOIN ps_feature_value fv ON (fl.id_feature = fv.id_feature) Link to comment Share on other sites More sharing options...
prestatent Posted May 27, 2015 Share Posted May 27, 2015 Try this. Should work. You may have to change the id_lang value for whatever language your store is: select a.id_product, a.name as product_name, d.name as feature_name, c.value as feature_valuefrom ps_product_lang a, ps_feature_product b, ps_feature_value_lang c, ps_feature_lang dwhere a.id_lang = 2and a.id_product = b.id_productand b.id_feature_value = c.id_feature_valueand a.id_lang = c.id_langand b.id_feature = d.id_featureand a.id_lang = d.id_lang Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now