Forum Discussion
Query group fields into one
Hi
I'm new to the community... forgive me if I'm not precise.
I'm looking for the best way to write a SQL query for MS Access, capable of obtaining the grouping of the values contained in the same field, but in different rows, and having the same key (not primary).
- I have 3 rows with the same key (i.e. "1234")
- each row has a precise text value in the "Field" field (Water, Earth and Air)
I would like to create a SQL query that results in a single row, with the concatenation of the contents of the "Field" fields.
1234 | Water |
1234 | Earth |
1234 | Air |
I want a query result like this
1234 | Water, Earth, Air |
also taking into account the fact that there can be NULL values.
Can you help me?
Thanks in advance
Hi,
You will need some VBA code for this, like prepared by Allen.
Servus
Karl
****************
Access Forever
Access News
Access DevCon
Access-Entwickler-Konferenz AEK - 19./20.10. Nürnberg- Gustav_BrockBrass Contributor
Use my DJoin function as fully explained in my article: