按Sku分组,合并数据 - 字符串聚合

时间:2017-01-12 18:33:11

标签: sql ms-access

我无法想到在访问中解决此问题的最佳方法。有一点需要注意。可能还有15个其他字段,但它们都应该是重复数据,就像sku一样。

Original
    Sku    |    Category
    Apple  |    Fruit
    Apple  |    Consumable

Need
    Sku    |    Category
    Apple  |    Fruit,Consumable

根据以下评论的见解,我能够完成这项工作

SELECT [rg test].PROD_CODE, DConcat("PRODREPGDE","[rg test]","[PROD_CODE] = '" & [PROD_CODE] & "'") AS [Reporting Group]
FROM [rg test]
GROUP BY [rg test].prod_code;

1 个答案:

答案 0 :(得分:0)

根据以下评论的见解,我能够完成这项工作

SELECT [rg test].PROD_CODE, DConcat("PRODREPGDE","[rg test]","[PROD_CODE] = '"    & [PROD_CODE] & "'") AS [Reporting Group]
FROM [rg test]
GROUP BY [rg test].prod_code;