我有一个 mySQL 查询:
SELECT work.ID AS workID
,team.ID AS team_ID
,team.name AS teamName
FROM work
LEFT OUTER JOIN team_work ON team_work.work_ID = work.ID
LEFT OUTER JOIN team ON team_work.team_ID = team.ID
返回以下示例结果:
workID team_ID teamName
1 10 Support
2 20 Dev
2 10 Support
3 30 Admin
4 40 Research
我想以表格格式将其输出到屏幕上,以便每个 workID 有一行,以及包含团队名称列表的列。就像是:
WORK ID | TEAM NAME
-------------------------
1 | Support
2 | Dev
| Support
3 | Admin
4 | Research
我知道查询中的查询不是正确的方法(即使它是最简单的)。我在嵌套数组上看到了一些东西,但作为一个新手,我不太清楚如何去做。
有人想花一些时间来说服我离开壁架吗?
谢谢...