N
N
Nikita Souvel2017-01-30 21:27:00
MySQL
Nikita Souvel, 2017-01-30 21:27:00

How can you select products?

Tell me how best to make a selection of goods by some parameters, for example, by price, or other parameters in the following scenario:
Table of goods:
ID | title | date | ...
Table of parameters (several rows for one product):
object_id | name | value
At the moment, everything has come to

SELECT *
FROM `object`
JOIN `object_param` ON `object_param`.`object_id` = `object`.`id`
ORDER BY `date` DESC
LIMIT 15

But in this scenario, in each line, lines are replaced and for each product only one meta field is substituted ...
What can be done in this case? (I tried to google, apparently not right or not googled)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
entermix, 2017-01-30
@Souvel1

Sampling:
If you need the results of fields with the same name from both tables, you can set aliases, use this construction:
phpclub.ru/mysql/doc/select.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question