Hello I would like to split string with "-" into columns, and not have duplicate rows. So I expect to have two more new columns. Thank you
Hello I would like to split string with "-" into columns, and not have duplicate rows. So I expect to have two more new columns. Thank you
Assuming the maximum number of columns is known in advance STRTOK_TO_ARRAY could be used:
SELECT STRTOK_TO_ARRAY(DELIVERY_ID, '|') AS arr
,arr[0]::string AS delivery_item_0
,arr[1]::string AS delivery_item_1
,arr[2]::string AS delivery_item_2
,arr[3]::string AS delivery_item_3
--,...
FROM tab