sql - MySQL LEFT JOIN where multiple values -


I have a query that adds to the product table on the Product_Attributes table. I would like to receive products that have a precise position of meat before.

Products that have the specialty ID 9 and 16 selected, but when I run this query, I will only find the product that gets the first ID

  WHERE ("AttributeValueID "= 9" and "AttributeValueID" = 16)   

I need those products to select both the attributes AttributeValueID = 9 and AttributeValueID = 9 Not only this or that feature Id. Using the / or is'not solution is for me.

Update:

Join "Productivity" "Productivity" at "Product_Autubles" on "Product Attribute" below "Productivity" = "SiteTree_Live". " ("ValueTax" & gt; = '100' and 'ValueTax' and ("5, 4" Thanks in advance for your help

The most flexible way to get a list of values ​​produced in response to Gordon's is to meet the specified criteria.

As an inline view You can use a query like Gordon (which is the set of products), and in this way a product against the table. These operations can be done by:

  SELECT p.ProductID, p.ProductName, ... products from P Zone (SELECT a.ProductID uses a product by a.ProductId Hing SM (a.AttributeValueID = 9)> 0 and SUM (A.VerticalVID = 16)> Based on the edit on the question of adding a snippet 0) SOSS ProductID = P. ProductID  < / Pre> 

UPDATE

of SQL text: Add (Select from product A properties is a.ProductID A whig SUM (a.AttributeValueID IN ('9', '8 ',' 7 ')) gt; 0 and SUM a.AttributeValueID IN ('5', '4')) gt; 0 Group a.ProductID) ON.ProductID = SiteTree_Live.ID where SiteTree_Live.PriceTax & gt; = '100' and SiteTree_Live.PriceTax & lt; = '200'

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -