Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/14/2018 in all areas

  1. У вас сама архитектура вроде бы не правильная. по первой части как бы так не пришлось воротить SELECT products.product_id FROM `test` products LEFT JOIN `test` filter_1 ON products.product_id = filter_1.product_id LEFT JOIN `test` filter_2 ON products.product_id = filter_2.product_id LEFT JOIN `test` filter_3 ON products.product_id = filter_3.product_id WHERE filter_1.`filter_id` = 1 AND filter_2.`filter_id` = 3 AND filter_3.`filter_id` = 4 GROUP BY products.`product_id` UPD: Ещё можно как то так, но всё равно мне не нравится SELECT DISTINCT product_id FROM `test` WHERE `filter_id` IN (1,3,4) GROUP BY `product_id` HAVING COUNT(`filter_id`) = 3 по второй хватит просто SELECT product_id FROM `test` WHERE `filter_id` IN (3, 4) GROUP BY `product_id`
    1 point
This leaderboard is set to Kiev/GMT+02:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy