Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / July 2006

Tip: Looking for answers? Try searching our database.

Concatenate values from multiple rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David - 26 Jul 2006 23:19 GMT
Hello,

Any way to use a GROUP BY function, or some other function, and then to
concatenate the returned string values in a particular field, from each
grouping?
Signature

David

John Vinson - 27 Jul 2006 00:11 GMT
>Hello,
>
>Any way to use a GROUP BY function, or some other function, and then to
>concatenate the returned string values in a particular field, from each
>grouping?

See

http://www.mvps.org/access/modules/mdl0004.htm

                 John W. Vinson[MVP]
Michel Walsh - 27 Jul 2006 00:27 GMT
Hi,

Yes.

Assume you start with a table, two columns, one for the field making the
group, for illustration, we will call it TheKey. The second field, call it
Concat, is an empty (NULL)  varchar(255) field.

SELECT DISTINCT TheKey , IIf(False,"",Null) AS concat INTO temp
FROM myTable;

can, as exemple, produce such a table.

Next, run a query like:

UPDATE temp INNER JOIN myTable ON temp.TheKey = myTable.TheKey
SET temp.concat = (temp.concat + ", ") & myTable.fieldToConcatenate

the result will be in table temp.

That works only for Jet.

Hoping it may help,
Vanderghast, Access MVP

> Hello,
>
> Any way to use a GROUP BY function, or some other function, and then to
> concatenate the returned string values in a particular field, from each
> grouping?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.