Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm facing a problem with concat few values from one field.
EX: I have two column called State,Value and those values are like...
State,Value
A,10
B,5
C,12
D,8
I want
State,Value
A/B,15
C/D,20
Can any one please tell me how to get this done.
Thanks in Advance.
Regards,
Arjun
What is the logic behind combining 1st 2 together and next 2 together? Is there another dimension based on which you want to combine them?
May be like this:
Table:
LOAD * INLINE [
Dim, State Value
1, A, 10
1, B, 5
2, C, 12
2, D, 8
];
FinalTable:
NoConcatenate
LOAD Dim,
Concat(State, '/') as State,
Sum(Value) as Value
Reisdent Table
Group By Dim;
Drop Table Table;
Hi Sunny,
There is no logic behind doing this, need to combine few dimension values.
I'm not sure how to do this.
you should have data like this, then only you will be able to use the concat
Data:
LOAD * inline [
ID,State,Value
1,A,10
1,B,5
2,C,12
2,D,8 ];
New:
noconcatenate
LOAD ID,
Concat(distinct State,'/') as State,
sum(Value) as Value
resident Data
group by ID;
drop table Data;
Need some basis to know what will be combined into groups, right? How else will you do it in your scenario?
Drop Table Data you mean
Yes, bhavnao ko samjo
samjh gaya
Kushal, I have one question.. What is the difference between your code and Sunny Code. Could you please elaborate that. Because, Sunny code is fine for that Issue....