MySQL - query to return CSV in a field?
- by StackOverflowNewbie
Assume I have the following tables:
TABLE: foo
- foo_id (PK)
TABLE: tag
- tag_id (PK)
- name
TABLE: foo_tag
- foo_tag_id (PK)
- foo_id (FK)
- tag_id (FK)
How do I query this so that I get a result like this:
==========================
| foo_id | tags |
==========================
| 1 | foo, bar |
| 2 | foo |
| 3 | bar |
--------------------------
Basically, I need all of foo's tags in one column, comma separated. Possible in MySQL?