Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Concatenate "code" of the same number and keep only one record

Concatenate "code" of the same number and keep only one record

Cette question est non répondue.(Marquer comme supposément répondue)

Privé pour:    Miguel Angel Baeyens  

Hello everybody,

I have a table with two fields: num and code

NumCode
1thd
2eys
1yed
3yei
4ujd
2edj
5edj
1ikd
3edj
6ikd
7ahi
1ike
8edo
9old

I would like to in the script (during the load of the table), concatenate all "codes" for the same number, and keep only one record by number, like this:

NumCode
1thdyedikdike
2eysedj
3yeiedj
4ujd
5edj
6ikd
7ahi
8edo
9old

Thank you for your help.

Zak

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi Zak,

Concat() function will do this job. Let try

[Test]:

LOAD * INLINE [

Num    ,    Val

1    ,    1a

2    ,    2b

3    ,    3c

1    ,    2a

2    ,    2b

3    ,    3c];

[Test2]:

LOAD

    Num            AS [NewNum],

    Concat(Val)    AS [NewVal]

Resident [Test] GROUP BY Num;

Hope it help.

Regards,

Sokkorn

View solution in original post

3 Replies
Sokkorn
Master
Master

Hi Zak,

Concat() function will do this job. Let try

[Test]:

LOAD * INLINE [

Num    ,    Val

1    ,    1a

2    ,    2b

3    ,    3c

1    ,    2a

2    ,    2b

3    ,    3c];

[Test2]:

LOAD

    Num            AS [NewNum],

    Concat(Val)    AS [NewVal]

Resident [Test] GROUP BY Num;

Hope it help.

Regards,

Sokkorn

Not applicable
Author

Hi Sokkorn,

That works, Thank's

Anonymous
Not applicable
Author

alternatively, you can also try..

LOAD

     Num,

     MaxString(Code) as Code

FROM....

Group By Num;