Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2006
    Posts
    3

    Unanswered: Combination of some columns

    Hello
    I am looking for a solution for the following problem:
    existing Table:
    1, A, xxx
    1, B, xxx
    1, C, xxx
    2, D, nnn
    2, E, nnn
    I'm only interested in then values of column 2.
    I want get the following result:
    1,"A,B,C", xxx
    2,"D,E", nnn

    So I need a query that can collect the different values of the column 2 and
    create a column that contain all collected values. (maybe separated with a comma)

    Is that possible with Oracle-mechanismn? I haven't found a group-function for that. Maybe I can define a own written function for that.

    Thank's a lot for your help
    Leo

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    What happens if you have a row like this: 1, C, xyz
    Is that a new row in the conversion?

    1,"A,B,C", xxx
    1,"C", xyz
    2,"D,E", nnn
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    Is this list (that is, different values for column 2) a fixed-width list of values ? like 5, 4, or 27 (alphabet) .. or can it be variable ? If its not, try looking for stragg over this site.

  4. #4
    Join Date
    Mar 2006
    Posts
    3
    Hi
    In the existing table are only column 2 different. All other columns have the same values. Column 1 includes the key of the row. so, for all rows with the same key only column 2 has a variable content.

    so I need a query-function like "Group by" with a "sum"-Function for alphabetic values. Instead of a sum I want a summery of the collected String-Values of column 2.

    For this case I haven't found a Oracle-function.

    Maybe you have a tip for me.

    lmpunzel

  5. #5
    Join Date
    Mar 2006
    Posts
    3
    Hi JMartinez
    the values of column 2 are variable. That is our problem.
    whitch solution can you recommend for fixed values? How should this work?
    Maybe we can change our way to create the tables.

    lmpunzel

  6. #6
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    He already suggested you to search for the stragg function on Ask Tom. Did you do that?

Posting Permissions

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