tags:

views:

12

answers:

1

I have a data set like this:

Column1  Column2
   1       A
   1       B
   1       C
   1       D
   2       E
   2       F
   2       G
   3       H
   3       I 

and I would like to merge it into something like this:

Column1  Column2
   1       A, B, C
   2       D, E, F, G
   3       H, I

Is it possible to do this in SQLite somehow? I though of GROUP BY Column1, but I don't see how I can combine the Column2 data in one string...

Thanks!

A: 
 SELECT Column1, group_concat(Column2) FROM Table GROUP BY Column1

group_concat takes an optional second argument (a string) to use as the concatenation separator if you don't want a single ',' character.

Larry Lustig