When I have string list like 1, 2, 3... I'd like to use this as one column
Ids
1
2
3
Is it possible by sql query?
ex) SELECT Ids from (1, 2, 3...)
<- I know this is not working.
When I have string list like 1, 2, 3... I'd like to use this as one column
Ids
1
2
3
Is it possible by sql query?
ex) SELECT Ids from (1, 2, 3...)
<- I know this is not working.
For MySQL 8.0.4+
Concatenate square brackets (
[]
) around your string to make it into a JSON array. Then useJSON_TABLE
to convert it into a table. See the MySQL JSON Table Functions for more info.Use a subquery of arbitrary digits to split your string.Instead of vals you can use '1,2,3'.
See it working