Hey guys.
I really need your help with this one. Hope you have some time over.
I have these two tables…
Products table:
ID Manufacturer Product_Name
------------------------------------------------------------
1 Nike Air Max Talldress
2 Adidas High Voltage
3 Puma Black Morris Shortdress
4 Nike Jordani Sway
InStock table:
(Products table)
ID Product_ID Color Size Quantity
----------------------------------------------------------------------------------------------
1 1 Black Medium 61
2 1 Black Large 26
3 1 Purple Small 37
4 2 Green Medium 74
5 3 Yellow Medium 101
6 4 White Large 22
When I use this statement:
SELECT Product_ID, Manufacturer, Product_Name, Color, GROUP_CONCAT(Size) AS Sizes
FROM InStock JOIN Products ON Products.ID = Product_ID
WHERE Color IN ('Black')
GROUP BY Product_ID, Color
...I get this result
Product_ID Manufacturer Product_Name Color Sizes
----------------------------------------------------------------------------------------------
1 Nike Air Max Talldress Black Medium, Large
In this case, that's exactly what I want, but...
When I add 'AND Size IN('Medium')' to the 'WHERE Clause' like this: "WHERE Color IN ('Black') AND Size IN ('Medium')" I get the same result but without 'Large' under Sizes.
I need to do something similar that returns the result set like above but with both sizes(all sizes) for that product, even though im searching for black and ONLY ‘Medium’.
Any ideas?
Bless
//Neo