本文介绍了Ms Access Query:通过查询连接行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我在 Ms Access 中有包含以下信息的表:
Suppose I have table in Ms Access with following information:
ColumnA ColumnB
1 abc
1 pqr
1 xyz
2 efg
2 hij
3 asd
我的问题是,如何将第二列中的值连接到基于第一列的行值.我想要的查询结果如下:
My question is, how can I concatenate the values in the second column to a row value based on the first column. The query results that I want is as follows:
ColumnA ColumnB
1 abc, pqr, xyz
2 efg, hij
3 asd
我想通过查询来实现这一点.有人能帮我实现这个吗?
I want to achieve this through a query. Can someone help me attain this?
推荐答案
您需要一个函数来进行串联.
You need a function to do the concatenation.
使用您的数据的示例:
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;
这篇关于Ms Access Query:通过查询连接行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!