我正在尝试编写一个MySQL查询,该查询从表"projects"中检索一条与表"tags"具有一对多关系的记录.我的应用程序使用4个表来执行此操作:
Projects - the projects table
Entities - entity table; references several application resources
Tags - tags table
Tag_entity - links tags to entities
Run Code Online (Sandbox Code Playgroud)
是否可以以表格"标签"中的多个值连接成一个结果列的方式编写查询?我更喜欢不使用子查询这样做.
表澄清:
-------------
| Tag_Entity |
------------- ---------- | ----------- | -------
| Projects | | Entities | | - id | | Tags |
| ----------- | | -------- | | - tag_id | | ----- |
| - id | --> | - id | --> | - entity_id | --> | id | …
Run Code Online (Sandbox Code Playgroud)