Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2012
    Posts
    28

    Results in one line

    Hello all

    Is it possible to get all the lines of a query next to each other? I.e. if a query normally returns:
    A;
    B;
    C;
    D;

    Is it possible to display this result as:
    A;B;C;D

    Thanks and regards

    S. BASU

  2. #2
    Join Date
    Aug 2008
    Posts
    140

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,479
    There are (at least) three ways, like ...
    http://www.dbforums.com/db2/1668330-...ing-comma.html
    If you are using DB2 9.7 fixpack 4 for LUW,
    you may want to use LISTAGG function.

    Otherwise, you can use XMLGROUP or XMLAGG function instead of LISTAGG function.

    Another way would be recursive-common-table-expression.

    You would find some examples by searching this forum with those keywords.

Posting Permissions

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