myTable的
name id number
Joe 20 72-11433.80-11427.14-6.66-R
kay 115 3-547.86-547.86-0.00-R
mary 85 12-0.49-0.49-0.00-R
从myTable中选择*
Joe 20 72-11433.80-11427.14-6.66-R
kay 115 3-547.86-547.86-0.00-R
mary 85 12-0.49-0.49-0.00-R
从myTable
中选择分组(数字,' \ - ')["72","11433.80","11427.14","6.66","R"]
["3","547.86","547.86","0.00","R"]
["12","0.49","0.49","0.00","R"]
SELECT explode(split(number,' \ - '))FROM myTable
72
11433.80
11427.14
6.66
R
我想知道是否有一个像爆炸功能一样的功能 但是所需的输出将是列而不是行。 这样: SELECT name,explode(split(number,' \ - '))FROM myTable
Joe 72 11433.80 11427.14 6.66 R
kay 3 547.86 547.86 0.00 R
mary 12 0.49 0.49 0.00 R
增加列数
答案 0 :(得分:1)
我不认为这样的功能存在。但你当然可以直接访问数组元素,一次一个,如下所示:
select split(number,'\-')[0], split(number,'\-')[1], split(number,'\-')[2], split(number,'\-')[3], split(number,'\-')[4] from myTable