Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2010
    Posts
    2

    Unanswered: put the result into list

    Hi,
    i have a data like below

    CASE_ID YEAR
    ---------- -------
    776 2007
    776 2008


    i want to get the year as a list for example

    CASE_ID YEAR
    776 2007,2008


    can i get it without using stored procedure?
    Any help would be most appreciated. Thanks.
    Last edited by missNyza; 12-21-10 at 22:52.

  2. #2
    Join Date
    Dec 2010
    Posts
    3

    shell script

    I'm not sure in db2. If I were you, I will shell script to do it.

  3. #3
    Join Date
    Dec 2010
    Posts
    7
    U can get output like that using simple query.

    select case_id,wm_concat(year)
    from table_name
    group by case_id


    Thanks,
    Naganath

  4. #4
    Join Date
    Jun 2007
    Location
    germany
    Posts
    155
    is the oracle function wm_concat, also for db2?
    Dick Brenholtz, Ami in Deutschland

  5. #5
    Join Date
    Dec 2010
    Posts
    2
    i'm using db2. wm_concat will give error SQLSTATE: 56098.
    maybe i should use shell script as suggested.

    thanks.

  6. #6
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    you can refer the db2 sql cookbook and find few examples there to denormalize result set in the output ( there are few for normalizing too). That will give you some direction.

    Jayanta Datta
    DB2 UDB DBA
    IBM India, Global Delivery
    New Delhi

Posting Permissions

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