在SQLite中,我有一个版本字段“ 10.2.30” /“ 15.5”。我想将版本分为3个字段,例如Manjor Release,Minor Release和Revision。例如
| Version |
|----------|
|10.2.30 |
|15.5 |
将其转换为
|Major Release|Minor Release|Revision|
|-------------|-------------|--------|
| 10 | 2 | 30 |
| 15 | 5 | 0 |
我尝试使用下面的代码,但是我正在努力拆分该值。请与我们分享您的想法。
select
substr('10.2.30', 0, (instr('10.2.30','.'))) as MajorRelease,
substr('10.2.30',instr('10.2.30','.')+1, instr(substr('10.2.30',instr('10.2.30','.')), ".")) as MinorRelease