So I created a column that concatenate all the strings like this
| col1 |
|-----------------------------------|
| key,board, warrior,123,ADD |
|-----------------------------------|
| First,First, Last, Name,112,Delete|
and I'm trying to figure out to a way to split them with just comma, not space and comma.
SELECT
SPLIT_PART(COL1, ',' 1) AS COL1,
SPLIT_PART(COL1, ',' 2) AS COL2,
SPLIT_PART(COL1, ',' 3) AS COL3,
SPLIT_PART(COL1, ',' 4) AS COL4
FROM TABLE1
This separates everything with comma like this
| col1 | col2 | col3 | col4 |
|-----------------------------|
| key | board |warrior| 123 |
| First| First | Last | Name |
And I want to split them like this below.
| col1 | col2 | col3| col4 |
|----------------------------------------|
| key | board, warrior | 123 | ADD |
| First| First, Last, Name | 112 | Delete|
I couldn't find a good reference for this. Please help!
CodePudding user response: