Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Concat multiple text rows

Hi,

I have a table of the structure

 

NumberRowText
11Text1
21Text1
22Text2

an I would like to transform it into a table of the structure

 

NumberText
1Text1
2

Text1 Text2

So I would like to concatenate each row of text with the same dataset number (first column) in just one row.

Thanks for any suggestion

Michael

5 Replies
tamilarasu
Champion
Champion

Hi Michael,

Try to load like


load

Number

Concat(Text,' ') as NewText

resident Data

Group by Number;


I assume that your data loaded under the table name Data.. so i have used resident load.. if not adapt tour code with concat(Field,' ') as NewFieldname.. Let me know.

Mark_Little
Luminary
Luminary

Hi,

Like Tamil suggested, Just to expand a with a coded example.

Table1:

LOAD * INLINE [

    Number, Row, Text

    1, 1, Text1

    2, 1, Text1

    2, 2, Text2

];

NoConcatenate

Table2:

Load

  Number,

  Concat(Text,' ') as NewText

Resident Table1

Group by Number;

Drop Table Table1;

Anonymous
Not applicable
Author

try this one:

Test1:

load

Number,

Concat('Text'&''&Row) as Text

Resident Test

group by Number;

Hope this will help!!

Anonymous
Not applicable
Author

PFA..

Anonymous
Not applicable
Author

Hi,

Thanks for your response. With a little modification, I got what I needed:

load

ID,

Concat(Text,' ',Number) as NewText

resident Data

Group by ID;

Regards

Michael