sql语句实现数据透视?

+------------------------+-------------------------------------------+| book                   | name                                      |
+------------------------+-------------------------------------------+| C#高级编程             | 小王,小张,小李                            || java从入门到精通       | 小王,小李,小赵,小张,小杨,小马             |
+------------------------+-------------------------------------------+

如上是一个数据表,从中提取数据输出的样式如下:

+--------+------------------------+
| name   | book                   |
+--------+------------------------+
| 小马   | java从入门到精通       |
| 小赵   | java从入门到精通       |
| 小王   | C#高级编程             |
| 小杨   | java从入门到精通       |
| 小王   | java从入门到精通       |
| 小张   | java从入门到精通       |
| 小王   | C#高级编程             |
| 小李   | java从入门到精通       |
| 小张   | C#高级编程             |
+--------+------------------------+

如何实现?


隔江千里
浏览 671回答 1
1回答

PIPIONE

postgres的话,使用unnest
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5