INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

oracle wm_concat() to teradata ??, recursive?, other?

oracle wm_concat() to teradata ??, recursive?, other?

(OP)
I'm new to teradata, and some of the differences really have me stumped.  From what I've read I need to replace wm_concat() with a recursive query to aggregate rows, but I'm having a hekuva time figuring it out. Any help you can provide is appreciated.

For the sake of the discussion, I have a table with two columns:  'plan' and 'consolidate'.  Each value in 'plan' is unique, and no values in 'consolidate' are believed unique.  The 'consolidate' field is used to roll up the 'plan' values into operational groups.

The task is to aggregate the values in the rows of 'plan' into a single row for 'consolidate' seperated by commas or some other delimiter.

So for the following values:

|plan  |consolidate|
|MO    |1          |
|IL    |1          |
|AR    |1          |
|KS    |2          |
|MS    |3          |
|LA    |3          |
|TX    |3          |
|OK    |2          |

I'd like to get the following results (in no particular order):

|consolidate  |rollup     |
|1            |MO, IL, AR |
|2            |KS, OK     |
|3            |MS, LA, TX |

Can anyone help with this?  Perhaps a recursive isn't the best solution in Teradata?   

Michael Phipps
Technical Business Analyst
Mercy Health Plans
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close