0

I have an access database with over 210k records. they are a list of product codes. with associated product codes. I want to create an access query that associates only one product code per line but merges the associated products into a single column matched to that product code but sepertaed by a , (comma)

Example of columns in access database

Product code: Associated product 
100000 2548741
100000 4578214
100000 1254712
100000 5687412
100000 1469787 
100000 9874582
100000 5478126

I want the following

Product code: Associated product 
100000 2548741,4578214,1254712,5687412,1469787 ,9874582, 5478126

Thanks in advance.

MUS
  • 1,450
  • 4
  • 17
  • 30
  • You're looking for a GROUP_CONCAT like solution: http://stackoverflow.com/questions/2852892/is-there-a-group-concat-function-in-ms-access – GolezTrol Aug 08 '11 at 18:53

2 Answers2

1

Create a SQL query that retrieves the data that you want. Use some client-side code to format the data the way you want.

SQL is used to manipulate (retrieve, add, remove, update) data, not to format it in a specific output format.

Frederik Gheysels
  • 56,135
  • 11
  • 101
  • 154
1

This is how to do in vba: http://support.microsoft.com/kb/318642

JeffO
  • 7,957
  • 3
  • 44
  • 53