Hi,
How to convert multiple rows of data into single row?
ex: input
field1
a
b
c
d
output:
a,b,c,d
How to convert multiple rows of data into single row
Moderators: chulett, rschirm, roy
Re: How to convert multiple rows of data into single row
adams06 wrote:Hi,
How to convert multiple rows of data into single row?
ex: input
field1
a
b
c
d
output:
a,b,c,d
1)pivot stage
Re: How to convert multiple rows of data into single row
Hi Prabu,
can you explain in detail
Thanks
can you explain in detail
Thanks
prabu wrote:adams06 wrote:Hi,
How to convert multiple rows of data into single row?
ex: input
field1
a
b
c
d
output:
a,b,c,d
1)pivot stage
The pivot stage reads 1 row with 4 columns and it generates 4 rows with 1 column.
If you you want to read multiple rows (1 column) into single row with the content of the column field1 of all rows, use ROW MERGE stage, but include transforms stage before the row merge stage for connects ";" in the end of the column.
Ex.:
Input --> Transformer --> Row Merge --> Output
a --> a : ";" -->
b --> b : ";" -->
c --> c : ";" -->
d --> d : ";" --> --> a;b;c;d
If you you want to read multiple rows (1 column) into single row with the content of the column field1 of all rows, use ROW MERGE stage, but include transforms stage before the row merge stage for connects ";" in the end of the column.
Ex.:
Input --> Transformer --> Row Merge --> Output
a --> a : ";" -->
b --> b : ";" -->
c --> c : ";" -->
d --> d : ";" --> --> a;b;c;d