|
最佳回答 |
3
|
PoseidonLv5高级互助发布于2019-12-24 14:55(编辑于 2021-4-25 11:54)
|
先拆;然后拆:分列。
有一个深入的难点,就是第一个行是2组,但如果是n组呢?
with T1 as
(SELECT distinct REGEXP_SUBSTR(data, '[^;]+', 1, level, 'c') AS source_string
FROM test_split
connect by level <=
length(data) - length(REGEXP_REPLACE(data, ';', '')) + 1)
select source_string,substr(source_string, 1, instr(source_string, ':',1,1) - 1) first,
substr(source_string, instr(source_string, ':',1,1) +1, (instr(source_string, ':',1,2) - instr(source_string, ':',1,1)-1)) second,
substr(source_string, instr(source_string, ':',1,2) +1, (instr(source_string, ':',1,3) - instr(source_string, ':',1,2)-1)) third,
substr(source_string, instr(source_string, ':',1,3) +1) forth
from t1
|
|
|
|
最佳回答 |
1
|
WilldofineLv5见习互助发布于2021-4-25 07:19(编辑于 2021-4-25 11:54)
|
先拆;然后拆:分列。
有一个深入的难点,就是第一个行是2组,但如果是n组呢?
with T1 as
(SELECT distinct REGEXP_SUBSTR(data, '[^;]+', 1, level, 'c') AS source_string
FROM test_split
connect by level <=
length(data) - length(REGEXP_REPLACE(data, ';', '')) + 1)
select source_string,substr(source_string, 1, instr(source_string, ':',1,1) - 1) first,
substr(source_string, instr(source_string, ':',1,1) +1, (instr(source_string, ':',1,2) - instr(source_string, ':',1,1)-1)) second,
substr(source_string, instr(source_string, ':',1,2) +1, (instr(source_string, ':',1,3) - instr(source_string, ':',1,2)-1)) third,
substr(source_string, instr(source_string, ':',1,3) +1) forth
from t1
|
|
|
|
最佳回答 |
0
|
黄源Lv6中级互助发布于2019-12-24 12:11(编辑于 2021-4-25 11:54)
|
先拆;然后拆:分列。
有一个深入的难点,就是第一个行是2组,但如果是n组呢?
with T1 as
(SELECT distinct REGEXP_SUBSTR(data, '[^;]+', 1, level, 'c') AS source_string
FROM test_split
connect by level <=
length(data) - length(REGEXP_REPLACE(data, ';', '')) + 1)
select source_string,substr(source_string, 1, instr(source_string, ':',1,1) - 1) first,
substr(source_string, instr(source_string, ':',1,1) +1, (instr(source_string, ':',1,2) - instr(source_string, ':',1,1)-1)) second,
substr(source_string, instr(source_string, ':',1,2) +1, (instr(source_string, ':',1,3) - instr(source_string, ':',1,2)-1)) third,
substr(source_string, instr(source_string, ':',1,3) +1) forth
from t1
|
|
|
|
最佳回答 |
0
|
JackloveLv7高级互助发布于2019-12-24 13:03(编辑于 2021-4-25 11:54)
|
先拆;然后拆:分列。
有一个深入的难点,就是第一个行是2组,但如果是n组呢?
with T1 as
(SELECT distinct REGEXP_SUBSTR(data, '[^;]+', 1, level, 'c') AS source_string
FROM test_split
connect by level <=
length(data) - length(REGEXP_REPLACE(data, ';', '')) + 1)
select source_string,substr(source_string, 1, instr(source_string, ':',1,1) - 1) first,
substr(source_string, instr(source_string, ':',1,1) +1, (instr(source_string, ':',1,2) - instr(source_string, ':',1,1)-1)) second,
substr(source_string, instr(source_string, ':',1,2) +1, (instr(source_string, ':',1,3) - instr(source_string, ':',1,2)-1)) third,
substr(source_string, instr(source_string, ':',1,3) +1) forth
from t1
|
|
|
|
最佳回答 |
0
|
cherry团子Lv6中级互助发布于2019-12-24 13:05(编辑于 2021-4-25 11:54)
|
先拆;然后拆:分列。
有一个深入的难点,就是第一个行是2组,但如果是n组呢?
with T1 as
(SELECT distinct REGEXP_SUBSTR(data, '[^;]+', 1, level, 'c') AS source_string
FROM test_split
connect by level <=
length(data) - length(REGEXP_REPLACE(data, ';', '')) + 1)
select source_string,substr(source_string, 1, instr(source_string, ':',1,1) - 1) first,
substr(source_string, instr(source_string, ':',1,1) +1, (instr(source_string, ':',1,2) - instr(source_string, ':',1,1)-1)) second,
substr(source_string, instr(source_string, ':',1,2) +1, (instr(source_string, ':',1,3) - instr(source_string, ':',1,2)-1)) third,
substr(source_string, instr(source_string, ':',1,3) +1) forth
from t1
|
|
|
|
最佳回答 |
0
|
山夕Lv5见习互助发布于2020-9-18 16:42(编辑于 2021-4-25 11:54)
|
先拆;然后拆:分列。
有一个深入的难点,就是第一个行是2组,但如果是n组呢?
with T1 as
(SELECT distinct REGEXP_SUBSTR(data, '[^;]+', 1, level, 'c') AS source_string
FROM test_split
connect by level <=
length(data) - length(REGEXP_REPLACE(data, ';', '')) + 1)
select source_string,substr(source_string, 1, instr(source_string, ':',1,1) - 1) first,
substr(source_string, instr(source_string, ':',1,1) +1, (instr(source_string, ':',1,2) - instr(source_string, ':',1,1)-1)) second,
substr(source_string, instr(source_string, ':',1,2) +1, (instr(source_string, ':',1,3) - instr(source_string, ':',1,2)-1)) third,
substr(source_string, instr(source_string, ':',1,3) +1) forth
from t1
|
|
|
|
最佳回答 |
0
|
shirley930107Lv5见习互助发布于2021-3-23 15:41(编辑于 2021-4-25 11:54)
|
先拆;然后拆:分列。
有一个深入的难点,就是第一个行是2组,但如果是n组呢?
with T1 as
(SELECT distinct REGEXP_SUBSTR(data, '[^;]+', 1, level, 'c') AS source_string
FROM test_split
connect by level <=
length(data) - length(REGEXP_REPLACE(data, ';', '')) + 1)
select source_string,substr(source_string, 1, instr(source_string, ':',1,1) - 1) first,
substr(source_string, instr(source_string, ':',1,1) +1, (instr(source_string, ':',1,2) - instr(source_string, ':',1,1)-1)) second,
substr(source_string, instr(source_string, ':',1,2) +1, (instr(source_string, ':',1,3) - instr(source_string, ':',1,2)-1)) third,
substr(source_string, instr(source_string, ':',1,3) +1) forth
from t1
|
|
|
|
最佳回答 |
0
|
yzmGcMwe1752561Lv2见习互助发布于2022-12-13 15:38
|
sqlite 不支持函数 regexp_substr 的吧
|
|
|