Results 1 to 3 of 3

Thread: SQL Help

  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unanswered: SQL Help

    I need help in concatenating the results of an SQL into a single string.
    Is there an aggregate grouping function on string in DB2?

    Ex:

    SQL: Select FirstName from Employee

    This returns all the rows in the Employee table with just the FirstName Column. Instead of multiple rows, I want to return just one string with all the values of the rows concatenated and seperated by ",". Can this be done in DB2 procedure or SQL?

    Thanks in advance

    ykc

  2. #2
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525

  3. #3
    Join Date
    Feb 2004
    Posts
    2
    Thanks Damian,
    Unlike in the thread you forwarded, I am doing this in a procedure and I can declare a temporary variable and loop through the result rows and concatenate the values to this temporary variable. I am just not familiar with SQL syntax to do this. I am thinking there should be a simpler program to accomplish this. Any help is greatly appreciated

    Thanks
    ykc

Posting Permissions

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