Jump to content

database help mysql phpmyadmin


Recommended Posts

I'm trying to do the following query:

SELECT p.product_id, q.name, p.model, p.image, p.price FROM `root_product` p LEFT JOIN `root_product_description` q ON (p.product_id = q.product_id) LEFT JOIN `root_product_attribute` pa ON (p.product_id = pa.product_id) WHERE pa.product_id IN (SELECT pa.product_id FROM `root_product_attribute` WHERE `attribute_id` = '37' AND `text` = 'Blue') AND `attribute_id` = '35' AND `text` = 'Boys'

What I'm trying to do is retrieve the name, model, image, price of all products contained in "root_product" and "root_product_description" that have a specific color and gender from database "root_product_attribute".

The first two tables: root_product, root_product_description have a standard horizontal layout.

The last table (the one I'm having the issues with): root_product_attribute has a vertical layout:

So using the query above and the below image I would want the query to return the info that I want from product 699 and 700 below




Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...