我在一个MySQL数据库中有两个表,除法和模板。
division
- DivisionID
- DivisionName
template
- TemplateID
- TemplateName下面是我当前数据集的一个示例。
division
- 1, Marketing
- 2, Commerce
- 3, Infrastructure
template
- 1, Awareness
- 2, AAR Summary
- 3, Release Acceptance我在找一组结果:
Marketing Awareness
Marketing AAR Summary
Marketing Release Acceptance
Commerce Awareness
Commerce AAR Summary
Commerce Release Acceptance
Infrastructure Awareness
Infrastructure AAR Summary
Infrastructure Release Acceptance我所看到的与此类似的其他所有东西都是使用PHP或其他脚本来完成的。我如何使用纯MySQL实现这样的目标?
发布于 2014-11-12 21:23:56
对于不同的列
select DivisionName, TemplateName from division join tmplate;如果要将每一行作为单个列字符串
select concat(DivisionName,' ', TemplateName) from division join tmplate;https://dba.stackexchange.com/questions/82518
复制相似问题