2

Is there a way to convert a list of values into a comma-delimited string in Informix? For example, I have the following query as a subselect:

SELECT [State] From States

I would like to convert all the values from that select into a comma-separated list.

Can I do that in informix?

Skadoosh
  • 2,536
  • 8
  • 40
  • 52
  • You can do it but be careful though or Informix will corrupt your data. – ChaosPandion Sep 24 '10 at 15:40
  • I am outputting the values to a report. I am not inserting it anywhere. In any case, how can I do it? Is there a built in function that I can utilize? – Skadoosh Sep 24 '10 at 15:43
  • Possible duplicate of [Show a one to many relationship as 2 columns - 1 unique row (ID & comma separated list)](https://stackoverflow.com/questions/715350/show-a-one-to-many-relationship-as-2-columns-1-unique-row-id-comma-separate) – alk Aug 10 '18 at 10:18

1 Answers1

3

I think the answer you need is given in these questions: SO 715350, SO 489081. It shows how to create and use a GROUP_CONCAT() aggregate that will do exactly what you want. The functionality is otherwise not available - that is, you have to add it to Informix, but it can (fairly) easily be added.

Community
  • 1
  • 1
Jonathan Leffler
  • 698,132
  • 130
  • 858
  • 1,229