PrestoDB Query to concat data from rows and columns into one string

Viewed 33

I Have a table like and want to insert an additional column by joining data from multiple rows an d columns. I Have a table like:

and wanted result as: and wanted result as:

Tried :

concat_ws(':', nrarf, chDl, Indicator, carrier, cellTech, Coreset, mer1NR)

but i am not getting the desired result, I am getting the output as given below, please help.enter image description here

1 Answers

Your code only concats columns. Below code, I think is what you want.

Declare @FinalString nvarchar(max) = ''

Select @FinalString += Concat(col1, ':', col2, ':', col2, ....) + ','
FROM table_name
Related