Select 来自 table 的数据,如果它们重复将其添加到新列中
Select data from table and if they repeat add it in new column
我有:
ID SKU PRODUCT
=======================
1 FOO-23 Orange
2 BAR-23 Orange
3 FOO-24 Apple
4 FOO-25 Orange
5 BAR-24 Apple
我要
Orange FOO-23 BAR-23 FOO-25
Apple FOO-24 Bar-24
我必须使用哪种查询?
select product, group_concat(SKU separator ' ' ) as skus
from your_table
group by product
我有:
ID SKU PRODUCT
=======================
1 FOO-23 Orange
2 BAR-23 Orange
3 FOO-24 Apple
4 FOO-25 Orange
5 BAR-24 Apple
我要
Orange FOO-23 BAR-23 FOO-25
Apple FOO-24 Bar-24
我必须使用哪种查询?
select product, group_concat(SKU separator ' ' ) as skus
from your_table
group by product