在哪里组合价值

时间:2019-07-08 11:52:34

标签: mysql

我有如下表结果 enter image description here

它来自

Event::all()->pluck('event_start_date);

我需要从尺寸:S和白色中进行选择,并且具有相同的id_product_attribute值。 我正在尝试使用组concat做到这一点。但是不知道

我期待

SELECT ps_product_attribute.id_product, 
       ps_attribute_lang.id_attribute, 
       Concat(ps_attribute_group_lang.public_name, ': ', ps_attribute_lang.NAME) 
       AS 
       Attr, 
       ps_product_attribute_combination.id_product_attribute, 
       ps_attribute_group_lang.id_attribute_group 
FROM   ps_product_attribute 
       INNER JOIN ps_product_attribute_combination 
               ON ps_product_attribute.id_product_attribute = 
                  ps_product_attribute_combination.id_product_attribute 
       INNER JOIN ps_attribute 
               ON ps_product_attribute_combination.id_attribute = 
                  ps_attribute.id_attribute 
       INNER JOIN ps_attribute_group_lang 
               ON ps_attribute.id_attribute_group = 
                  ps_attribute_group_lang.id_attribute_group 
       INNER JOIN ps_attribute_lang 
               ON ps_attribute.id_attribute = ps_attribute_lang.id_attribute 
                  AND ps_attribute_group_lang.id_lang = 
                      ps_attribute_lang.id_lang 
WHERE  ( ps_attribute_lang.id_lang = 1 ) 
       AND ( ps_product_attribute.id_product = 1 ) 

0 个答案:

没有答案