Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005

    Unanswered: Rows into one row as comma delimited string

    HI All

    Is it possible to generate such a result set with a query in informix?

    With my existing query I am getting this resultset:

    SystemName Numbers
    A 111
    A 222
    B 123
    B 356
    B 777
    C 888

    and I would like get a result set like this:

    SystemName Numbers
    A 111;222
    B 123;356;777
    C 888

    Thanks alot in advance.
    Last edited by tyaramis; 11-27-09 at 05:44. Reason: Title was wrong.

  2. #2
    Join Date
    Aug 2006
    The Netherlands
    Not in a query. What you want to do should be done in a stored function or simply in a programming environment. For instance if you're working on a UNIX system and this query is executed in dbaccess you could redirect the Output To-pipe:
    awk '{a[$1] = (length(a[$1]) > 0) ? a[$1] ";" $2 : a[$1] $2}END{for(i in a)print i, a[i]}'

  3. #3
    Join Date
    Apr 2007
    Jundiai / SP - Brasil
    using SPL (Stored Procedure) , yes you can.. but depending the amount of data , the performance will no be good.

    If you need to much this and use IDS >= 9.40, can write a function in C, and probably your process speed will be much better.
    César Inacio Martins
    Jundiai / SP - Brasil - em Português - English (translated by Google).

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts