テーブル「タグ」と1対多の関係にあるテーブル「プロジェクト」から1つのレコードを取得するMySQLクエリを作成しようとしています。私のアプリケーションはこれを行うために4つのテーブルを使用します:
Projects - the projects table
Entities - entity table; references several application resources
Tags - tags table
Tag_entity - links tags to entities
テーブル「タグ」の複数の値が1つの結果列に連結されるようにクエリを作成することは可能ですか?サブクエリを使用せずにこれを実行したいと思います。
表の説明:
-------------
| Tag_Entity |
------------- ---------- | ----------- | -------
| Projects | | Entities | | - id | | Tags |
| ----------- | | -------- | | - tag_id | | ----- |
| - id | --> | - id | --> | - entity_id | --> | id |
| - entity_id | ---------- ------------- | name |
------------- -------
望ましい結果:
Projects.id Entities.id Tags.name (concatenated)
1 5 'foo','bar','etc'