Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
| Num | Code |
| 1 | thd |
| 2 | eys |
| 1 | yed |
| 3 | yei |
| 4 | ujd |
| 2 | edj |
| 5 | edj |
| 1 | ikd |
| 3 | edj |
| 6 | ikd |
| 7 | ahi |
| 1 | ike |
| 8 | edo |
| 9 | old |
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:
| Num | Code |
| 1 | thdyedikdike |
| 2 | eysedj |
| 3 | yeiedj |
| 4 | ujd |
| 5 | edj |
| 6 | ikd |
| 7 | ahi |
| 8 | edo |
| 9 | old |
Thank you for your help.
Zak
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
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
Hi Sokkorn,
That works, Thank's ![]()
alternatively, you can also try..
LOAD
Num,
MaxString(Code) as Code
FROM....
Group By Num;