Forum Discussion

Fra_Ran's avatar
Fra_Ran
Copper Contributor
Jul 17, 2024

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.

1234Water
1234Earth
1234Air

I want a query result like this

1234Water, Earth, Air

also taking into account the fact that there can be NULL values.

Can you help me?

Thanks in advance

Resources