convert multiple rows into a single row and concatenate the values

Teradata Applications

convert multiple rows into a single row and concatenate the values

I have a table that has data which looks like this:

L1   1   0   u1

L1   1   0   u2

L2   1   0   u1

L2   1   0   u2

L2   1   0   u3

and I would like the result to look like this:

L1  1  0  u1_u2

L2  1  0  u1_u2_u3

For each value in the first 3 rows, all the values in the 4th column need to be listed as comma or underscore separated values(concatenated).

I have tried using XMLAGG function but its  very slow and has high CPU usage. Is there any better way to do it in Teradata SQL? Thanks in advance!!