小编典典

Ms Access查询:通过查询连接行

sql

假设我在Access中具有以下信息的表格:

ColumnA ColumnB
1       abc
1       pqr
1       xyz
2       efg
2       hij
3       asd

我的问题是,如何将第二列中的值连接到基于第一列的行值。我想要的查询结果如下:

ColumnA ColumnB
1       abc, pqr, xyz
2       efg, hij
3       asd

我想通过查询来实现。有人可以帮我实现吗?


阅读 234

收藏
2021-05-16

共1个答案

小编典典

使用数据的示例:

Select T.ColumnA
  , GetList("Select ColumnB From Table1 As T1 Where T1.ColumnA = " & [T].[ColumnA],"",", ") AS ColumnBItems
From Table1 AS T
Group By T.ColumnA;
2021-05-16