ktr wrote:
Does anyone know how to perform an aggregate string concatenation in Microsoft Access without using a VBA module? I want pure SQL.
Across columns of a table is easy. Ex:
People
Id Name Dob
1 John 1/2/1975
2 Bob 1/2/1975
3 Tim 5/7/1955
MS Access SQL:
SELECT p.Id, (p.Name & ' ' & p.Dob) AS Person
FROM People p
I have no idea how I would go about concatenating rows. Does anyone have experience with that?
Ex: Get a comma-delimited list of people with the same birthday
Results should look like this:
Dob People
1/2/1975 John, Bob
5/7/1955 Tim
Thanks for the help.
in "pure" sql you can't really do that ....
with MSSQL there is a trick that can kind of do that but even then it just takes N rows and makes 1 row.
in MSSQL server you would need to use a MS / TSQL extension
or use a stored proc with a cursor.
I would just do it with a small bit of VBA code ....
order on the DOB and build a row till DOB <> LastDOB
then start the next set/row
just a while loop on a recordset till you hit the end.
not hard.