mysql - Limit JOIN query on specific table -


I'm trying to do a selected query on two tables, one of which, for example, the product, and others In which the colors can be selected for those products.

Each product has a different color that can be selected; Some have only one color, others can have 20 of them.

In the scope of the query, it is to parse the list of 20 products with all the available colors, which means that the number of colors per product is not limited, but the products displayed do not.

My current query looks like this:

  SELECT p * , C. * C products as left out in the form of pi. ColorProductID = p.ProductID Group by p.ProductID command p.ProductID ASC, c.ColorID ASC LIMIT 0,20  

The problem with this question is that it is actually only from the database Brings 20 products, but it provides only one available color instead of all available colors of the product.

How can I change my query to bring only 20 products, but there is no limit on the colors of every product?

Thank you in advance!

  SELECT p *, C. * FROM (* Select * 0,20 from the range of products) in the form of p. C to add colors. ColorProductID = p.ProductID by command p.ProductID ASC, c. Colorado ASC  

Edit: Fixed queries


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -