2013-03-25 70 views
6

我有这样的一个表:串连记录和GROUP BY在Access

title    part     desc 
Blah This   1      This begins the 
Blah This   2      example table. 
Some Record   1      Hello 
Another    1      This text extends a bit 
Another    2      further so it is in 
Another    3      another record in the 
Another    4      table 

在Access中,我希望建立一个查询/ SQL中GROUP BY title并连接所有的desc领域,所以它看起来像这样:

title    desc 
Blah This   This begins the example table. 
Some Record  Hello 
Another   This text extends a bit further so it is in another record in the table 

这怎么能用SQL(没有VBA /脚本)完成? FOR XML PATH似乎不适用于Access,只有SQL Server。我在这里尝试过VBA How to improve efficiency of this query & VBA?,但它实在太慢了。

还是有一个函数可以使用,而不是连续运行,而查询已经打开?

+0

看看这个。不知道如果FOR XML PATH在Access中工作,但如果它的确如此,这是你的答案:http://stackoverflow.com/questions/14082863/concatenation-of-strings-by-for-xml-path – 2013-03-25 21:20:52

+1

有没有办法在Access中只使用Sql来做到这一点。 [你需要使用一个函数](http://wiki.lessthandot.com/index.php/Concatenate_a_List_into_a_Single_Field_%28Column%29)。 – 2013-03-25 21:25:36

回答