一行"aaa,bbb,ccc"怎么转换成多列
"aaa"
"bbb"
"ccc"
1
linyinma 2018-03-09 13:03:02 +08:00
REPLACE(table.column , ',', char(10));
将','替换成‘\n ’ |
2
gbin 2018-03-09 13:37:21 +08:00
substring_index(`table.column`,',',1) as c1, substring_index(substring_index(`table.column`,',',-2),',',1) as c2, substring_index(substring_index(`table.column`,',',-1),',',1) as c3;
参考: https://stackoverflow.com/questions/1096679/can-mysql-split-a-column |
4
rieuse 2018-03-09 13:56:34 +08:00 via Android
split_part 你看看
|
5
3a3Mp112 2018-03-09 13:59:51 +08:00
java 读出来拆分重新写进去方便。
|
7
mario85 2018-03-09 17:09:10 +08:00 1
|