Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
matildecapo
Contributor
Contributor

Combine the two columns into single column without loosing the data

Hi to everyone,

I have a table like that:

column1   column2  column3   column4

AA, BB       123              456             789

AB,CC       234               678              123

AA              567              786                 890

 

And i want a table like this:

column1   column2  column3   column4

AA               123              456             789

BB              123              456             789

AB              234               678              123

CC             234               678              123

AA              567              786               890

 

any advice?

Labels (1)
5 Replies
Raja2022
Contributor III
Contributor III

Please give a try with the below code and it should work and hope this helps:

Load distinct
SubField(column1,' ,') as column1,
column2,
column3,
column4
;

Load * inline [
column1|column2|column3|column4
AA, BB|123|456|789
AB,CC|234|678|123
AA|567|786|890
] (delimiter is '|');

vinieme12
Champion III
Champion III

there's no need of a preceding load, this can be done in a single pass

TableName:

Load subfield(column1,',') as column1,column2,column3,column4 inline [
column1|column2|column3|column4
AA, BB|123|456|789
AB,CC|234|678|123
AA|567|786|890
] (delimiter is '|');

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
matildecapo
Contributor
Contributor
Author

thanks for your help,

this will work if I have few data. However, my database have more than 30 columns and 50000 rows.

What should I do in that case?

vinieme12
Champion III
Champion III

You can try the solution first to gauge the performance

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Raja2022
Contributor III
Contributor III

I did used it on large data sets with out any issues,  So give a try...