连接最后一列查询结果,如果id匹配

时间:2017-01-11 09:40:47

标签: mysql

我通过使用选择查询获得此结果。

enter image description here

但实际上我想要的结果是例如:

| 23407 | 42 M-65 Giant jacket, Brandit | Size:L - colour:Olive   |
| 23417 | 42 M-65 Giant jacket, Brandit | Size:2XL - colour:Olive |
| 23413 | 42 M-65 Giant jacket, Brandit | Size:XL - colour:Black  |

1 个答案:

答案 0 :(得分:0)

您可能希望使用GROUP_CONCAT()att_namegroup by列中的id_product

select *, GROUP_CONCAT(att_name) as att_name
from 
  ( 
      // your posted query as subquery 
  ) xxx
group by id_product