I have the string like '1.1;1.6;1.4;1.9;1.12...'
I want to split the above string to rows based on the substring ';' like below in mysql without using while loop:
1.1
1.6
1.4
1.9
1.12
...
I have the string like '1.1;1.6;1.4;1.9;1.12...'
I want to split the above string to rows based on the substring ';' like below in mysql without using while loop:
1.1
1.6
1.4
1.9
1.12
...
I have a table of integers (i), with values (0-9)...
SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX('1.1;1.6;1.4;1.9;1.12',';',i+1),';',-1) x
FROM ints x;
+------+
| x |
+------+
| 1.1 |
| 1.6 |
| 1.4 |
| 1.9 |
| 1.12 |
+------+
This solution is essentially identical to that provided by fthiella at the link provided by Utsav
mysql does not have a native split function. you will either have to use a loop/cursor or create your own string splitting function using the documentation
https://dev.mysql.com/doc/refman/5.7/en/create-procedure.html