For example, I have the following table:
| Block |
| abcdefgh,12kjkjkj,231wewoxyz|
How can I convert it into:
| Block1 | Block2 | Block3 |
| abcdefgh | 12kjkjkj | 231wewoxyz |
Note:
I use Presto, btw.
Seems to me you would simply use split_part
function to create your columns, like so:
SELECT
split_part(Block, ',', 1) AS Block1,
split_part(Block, ',', 2) AS Block2,
split_part(Block, ',', 3) AS Block3,
split_part(Block, ',', 4) AS Block4,
split_part(Block, ',', 5) AS Block5,
split_part(Block, ',', 6) AS Block6,
split_part(Block, ',', 7) AS Block7,
split_part(Block, ',', 8) AS Block8,
split_part(Block, ',', 9) AS Block9
FROM
your_table
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