连接Access中的记录和GROUP BY [英] Concatenate records and GROUP BY in Access

查看:69
本文介绍了连接Access中的记录和GROUP BY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的表:

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中,我希望为GROUP BY title建立一个查询/SQL,并连接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. VBA?,但这太慢了.

还是有一个可以使用的功能在查询已打开时不能连续运行?

解决方案

Access:/中没有Group_Concat.可能没有排除VBA的解决方案.
这是一种可能:通过查询并置行

I have a table like this:

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

In Access, I am looking to build a query/SQL to GROUP BY title and concatenate the desc field so it looks like this:

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

How can this be done with just SQL (no VBA/scripts)? FOR XML PATH does not seem to work in Access, only SQL Server. I've tried VBA here How to improve efficiency of this query & VBA?, but it is simply too slow.

Or is there a function that can be used that is not continually run while the query is already open?

解决方案

There is no Group_Concat in Access :/. Probably there is no solution that excludes VBA.
Here is one possible: Concatenating Rows through a query

这篇关于连接Access中的记录和GROUP BY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆