Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concatenate records and GROUP BY in Access

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?

like image 313
JBurace Avatar asked Mar 25 '13 21:03

JBurace


People also ask

How do you combine text and fields in Access?

When you want to combine the values in two or more text fields in Access, you create an expression that uses the ampersand (&) operator. For example, suppose that you have a form that is called Employees.

What does GROUP BY mean in Access?

The GROUP BY clause in Access combines records with identical values in the specified field list into a single record. A summary value is created for each record if you include an SQL aggregate function , such as Sum or Count, in the SELECT statement.


1 Answers

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

like image 141
www Avatar answered Sep 30 '22 03:09

www