bhakum3
bhakum3

Reputation: 23

How to represent the result in Hive

enter image description here

I have two fields like above image.

The above three rows to be represented as single row as mentioned in same image.

Can someone let me know how to produce the above result in Hive without using UDF?

Upvotes: 0

Views: 23

Answers (1)

mck
mck

Reputation: 42332

You can use concat_ws:

select
    concat_ws(',', collect_list(concat_ws(':', col1, col2))) as output
from mytable

Upvotes: 1

Related Questions