这是我的结果集
id cpumanufacturer cpuseries
200014 Intel Core i7,Core i7 Extreme Edition
200015 Intel Core i7 Extreme Edition,Core i7
200259 Intel Core i7 Extreme Edition,Core i7
我想将cpu系列拆分为跨越多行 比如First Row输出应该是
200014 | Intel | Core i7
200014 | Intel | Core i7 Extreme Edition
答案 0 :(得分:2)
有一篇博客文章描述了一个存储过程,它将修改您的表:
id cpumanufacturer cpuseries
200014 Intel Core i7,Core i7 Extreme Edition
200015 Intel Core i7 Extreme Edition,Core i7
200259 Intel Core i7 Extreme Edition,Core i7
对此:
id cpumanufacturer cpuseries
200014 Intel Core i7
200014 Intel Core i7 Extreme Edition
200015 Intel Core i7 Extreme Edition
200015 Intel Core i7
200259 Intel Core i7 Extreme Edition
200259 Intel Core i7
博文: http://www.marcogoncalves.com/2011/03/mysql-split-column-string-into-rows/
请记住,这会修改表格,而不是您的查询结果。
您可能还会发现以下答案有用: https://stackoverflow.com/a/5344071/1005039