SQLite
I want to convert single row value seperate by ',' to multiple rows
Example :
Single_Row
6,7,8,9,10,11,12,13,14,15,16
Result must be :
MultipleRows
6
7
8
9
10
12
13
14
15
16
I tried doing it with substr function but getting unexpected result
select
numbers.n,
substr(CbahiHSSpecialtyUnits.units,numbers.n,1)
from
numbers inner join CbahiHSSpecialtyUnits
on LENGTH(CbahiHSSpecialtyUnits.units)
- LENGTH(REPLACE(CbahiHSSpecialtyUnits.units, ',', ''))>=numbers.n-1
WHERE HsSubStandardID=22 and SpecialtyID=2 and numbers.n>0
order by numbers.n;
One good thing is I'm getting number of rows correct.. But the values that should be separated is wrong .. Please note numbers table is I have created for indexing purpose, with the help of this post. SQL split values to multiple rows