Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Concatenate same fields from different rows

Hello,

I have a table containing these information

Num , Value

1 , A

1, B

2 , V

3, A

3 , D

4 , E

I would like to create a table with the following fields

Num Value

1 , A|B

2 , V

3 , A|D

4 , E

any idea ?

The data source is an SQL server 2008 Database.

Thanks for your help

Philippe

1 Solution

Accepted Solutions
jsn
Honored Contributor

Re: Concatenate same fields from different rows

Hi Philippe,

You might want to look at using the Concat() function. Here's an inline example based on your data:

T1:

LOAD * INLINE [

Num , Value

1,A

1,B

2,V

3,A

3,D

4,E

];

NoConcatenate

T2:

Load

          Num,

          Concat(Value,'|') as Value

Resident T1

Group by Num;

Drop table T1;

2 Replies
jsn
Honored Contributor

Re: Concatenate same fields from different rows

Hi Philippe,

You might want to look at using the Concat() function. Here's an inline example based on your data:

T1:

LOAD * INLINE [

Num , Value

1,A

1,B

2,V

3,A

3,D

4,E

];

NoConcatenate

T2:

Load

          Num,

          Concat(Value,'|') as Value

Resident T1

Group by Num;

Drop table T1;

Not applicable

Re: Concatenate same fields from different rows

Thanks a lot.

I always forgot that function.

That works perfectly,

Philippe

Community Browser