Answer the question
In order to leave comments, you need to log in
Selection of products from the database (where the product may either have no properties, or have several of them) that satisfy several conditions?
Hello everyone) I need help in selecting products from a table by several attributes / properties, the actual database structure is as follows:
Products table - products and their general properties are stored.
attributes table - available attributes are stored.
The products_attributes table - associates products with attributes (product id, attribute id and value).
Table examples:
The question is the following, when combining all tables (to get products with their attributes), a table is expected where the number of rows of one specific product is as many as it has attributes, and if you search for a product by any one attribute, it’s clear how, then let's say we can find a product whose color is both red and blue (that is, by two attributes), I don't quite understand how!? If anyone can explain I would be grateful!
Answer the question
In order to leave comments, you need to log in
\/\w+\/[0-9]+
There are special sites where you can "play around" with regular seasons.
For example:
https://regex101.com/r/ncxyKP/1
There is also a tutorial documentation .
Through GROUP BY and HAVING.
Have a look here: How to make a filter if the relationship between a record is 1 co...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question