我正在使用列状态为
的配置单元表**state**
taxes, TX
Washington, WA
New York, NY
New Jersey, NJ
现在我想分开状态列,我想把它写在新列中
**state** **code**
taxes TX
Washington WA
New York NY
New Jersey NJ
答案 0 :(得分:2)
select split(state,',')[0] as state
,ltrim(split(state,',')[1]) as code
from mytable
+------------+------+
| state | code |
+------------+------+
| taxes | TX |
| Washington | WA |
| New York | NY |
| New Jersey | NJ |
+------------+------+
答案 1 :(得分:0)
选择substr(name,0,instr(name,',') - 1),substr(name,instr(name,',')+ 1,10 )来自aa