Answer the question
In order to leave comments, you need to log in
How to turn such text (text1, text2, text3) into a column in mysql?
Whether it is possible to make somehow SELECT that the text would appear columns, type.
select (text1, text2, text3) as text;
and what would be like this
|text|
|text1|
|text2|
|text3|
Answer the question
In order to leave comments, you need to log in
can
create table Test(id integer, title varchar(100));
insert into Test(id, title) values(1, "text1,text2,text3,text4");
insert into Test(id, title) values(2, "text5,text6,text7,text8");
select t.id, t.title, iter.c,
SUBSTRING_INDEX(SUBSTRING_INDEX(t.title, ',', iter.c), ',', -1)
from Test t
JOIN (SELECT 1 AS c UNION SELECT 2 UNION SELECT 3 UNION SELECT 4) iter ON 1 = 1
ORDER BY t.id, iter.c;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question