I have a table in Presto:

I want:

I have used UNNEST function with split function but I am not able to split each line using '\n' or char(10)
SELECT Col1,split_Col2
FROM tbl
CROSS JOIN UNNEST(SPLIT(Col2,'\n')) AS t (split_Col2)
does not work.
Even this:
SELECT Col1,split_Col2
FROM tbl
CROSS JOIN UNNEST(SPLIT(Col2,char(10))) AS t (split_Col2)
does not work.
I am very new to Presto and it would be great if someone could help!
I think you meant to use the chr() function:
SELECT Col1,split_Col2
FROM tbl
CROSS JOIN UNNEST(SPLIT(Col2,chr(10))) AS t (split_Col2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With