Hello i want to split a resulting column in multiple columns just like on the link. But number of columns are not specific ;
Example
COL1 | OTHER COLUMNS
----------------------------------------
this,will,split | some value
also,this | some value
this,is,four,columns | some value
I want make this something like that ;
COL1 | COL2 | COL3 | COL4 | OTHER
----------------------------------------
this | will | split| NULL | some value
also | this | NULL | NULL | some value
this | is | four | columns| some value
edit
it looks like similar that question but not:
Can you split/explode a field in a MySQL query?
I want results in 1 row, I dont want something like that;
RESULT
-----
this
will
split
...
on that question you can see there is specific number of cols. bu i dont. :(
I think you can create one relational table and add multiple entry in relational table, hear you don't need to think about column, you have to add entry in row.
eg.
Table 1: ID | COL1 | OTHER COLUMNS ---------------------------------------- 1 |this,will,split | some value 2 |also,this | some value 3 |this,is,four,columns | some value Table2 ID | Table1_id | value ------------------------- 1 | 1 | this 2 | 1 | will 3 | 1 | split 4 | 2 | also 5 | 2 | this 6 | 3 | this 6 | 3 | is 6 | 3 | four 6 | 3 | columns
Please check this, i think fix your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.