I have the following MySQL table products:
id, code, name, color
1, 'D555', 'Men T-shirt', ''
2, 'D556', 'Black Men T-shirt', 'D556'
3, 'D557', 'Silver Men T-shirt', 'D556'
4, 'D558', 'Men T-shirt', ''
5, 'D559', 'Black Men T-shirt', 'D559'
6, 'D560', 'White Men T-shirt', 'D559'
The column color is not empty, if the product have another colors, for example:
The product with code 'D556' is black and it has silver color, too.
I'm using SELECT * FROM products, but now I want to SELECT the main products (without the sub-colors), i.e:
D555, D556, D558, D559.
- And after that I'll SELECT the sub-colors under the product (since it's about e-store for clothes).
Is it possible with that kind of structure of the table?
Thank you very much for the attention!