我尝试将一个列根据 " > " 分隔符划分为多达五个部分,但尝试过的方法都没有成功:
我尝试过
select
id,
compoundColumn,
split(compoundColumn," > ")[1] as "first"
split(compoundColumn," > ")[2] as "second"
from table
where compoundColumn is not null
这个没有起作用,而这个似乎有点起了作用(至少第一部分有,不是第n部分)
select
id,
compoundColumn,
first(split(compoundColumn," > ")) as "first"
nth(compoundColumn," > ")[n] as "second"
from table
我在这里找到了很多例子,但它们似乎都在说要使用方括号,但是方括号会引发错误:
异常:格式错误的SQL。更多信息:SQL语句出错:您的MySQL服务器版本所对应的语法正确性不在 [1] as "first" from table where compoundColumn IS NOT NULL 此行附近。