Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have one Table with two columns as below
Test | |
ColumnA | ColumnB |
A | D |
B | E |
C | F |
Loading in QV script as
Test: |
Load |
ColumnA |
ColumnB |
From Test; |
Requirement is to have single columnA with all the values from both columns as below. Please suggest
ColumnA |
A |
B |
C |
D |
E |
F |
Test:
Load
ColumnA
From Test;
Concatenate(Test)
Load
ColumnB as ColumnA
From Test;
Thank you Michele for your quick reply.
I am making changes in a data models that is already built so using above method id disturbing the data Model so please any other method where I can rename my field name
Are these fields associated with the model? What is the key?
You can left your model as it is and create one separate table with concatenated columns as suggested.
Hi Shivesh,
Please find my data and please suggest how to rename Region as Sub-continent or copy Region values to Sub-continent
Test:
LOAD * Inline [
Product, Sales ,Continent, Sub-continent, Region
A, 1, APAC, India, SriLanka
B, 2, Europe, UK , Ireland
C, 3, Australia, Aus, Aus
];
Test:
Load
AutoNumberHash128(Product) as %Product_Key,
AutoNumberHash128((Continent),(Sub-continent)) as %Con_Key,
Product,
Sales,
Continent,
Sub-continent,
Region
From Test;
Hi Priya. Maybe this
Test:
LOAD * Inline [
Product, Sales ,Continent, Sub-continent, Region
A, 1, APAC, India, SriLanka
B, 2, Europe, UK , Ireland
C, 3, Australia, Aus, Aus
];
Outer join(Test)
Load Product, Sales ,Continent, Region as [Sub-continent]
Resident Test; Drop Field Region from Test;
May be like this also: Not sure what you are trying to achieve:
Test:
LOAD * Inline [
Product, Sales ,Continent, Sub-continent, Region
A, 1, APAC, India, SriLanka
B, 2, Europe, UK , Ireland
C, 3, Australia, Aus, Aus
];
Noconcatenate
Test1:
Load
AutoNumberHash128(Product) as %Product_Key,
AutoNumberHash128((Continent),(Sub-continent)) as %Con_Key,
Product,
Sales,
Continent,
Sub-continent
From Test;
concatenate
Load
AutoNumberHash128(Product) as %Product_Key,
AutoNumberHash128((Continent),(Sub-continent)) as %Con_Key,
Product,
Sales,
Continent,
Region as Sub-continent
From Test;
Drop Table Test;
Br,
KC
Hi KC,
Thank you for your suggestion but with your method(Concatenation) some of the values are getting double
Please suggest any alterative if possible
Regards,
Priya
I am still not clear what do you mean by "rename Region as Sub-continent or copy Region values to Sub-continent"
While doing like this, either region values will be overwritten by Sub-continent values or vice versa.
Can you please share your expected output.
Br,
KC
So you need Region and Sub continent column with same values?