Help on adding column value recursively

Database
Enthusiast

Help on adding column value recursively

Help with Recursive query

 

Hi,

I have a unique scenario for which I would like to build a SQL to get desired result. Could you please help me find a SQL solution for this.

Here is how my data looks. here are 2 sets of records ..

 

Input   
Acct_noAcct_ceate_dateActiveBranch
100115-01-2011YA
100115-01-2011YB
100116-01-2011NX
100115-01-2011YC
100218-01-2011YE01
100218-01-2011YE01
100218-01-2011YE02

 

Desired Output  as

 

Acct_noAcct_ceate_dateActiveBranch
100115-01-2011YA,B
100116-01-2011NX
100218-01-2011YE01,E02

 

Any help with SQL would be greatly appreciated. Thank you

Tags (2)
3 REPLIES
Highlighted
Teradata Employee

Re: Help on adding column value recursively

Hi vinoth_84,

 

We need some rules here.

Why the C value is not in the output ?

Enthusiast

Re: Help on adding column value recursively

Hi Walder,

 

sorry it was tryp error  the value C aslo shold in the 1st record A,B,C for that date

Teradata Employee

Re: Help on adding column value recursively

Well, it's kinda the same code that on your other recursive subject : XMLAgg will do the job.

Maybe do a distinct first to remove the E01 duplicate if not needed.