I have two SQL tables. customer and tag joined on the customer.id=tag.attach_id
customer
+------+-------------+--------------+
| id | name | email |
| 9 | Alan | alan@me.com |
+------+-------------+--------------+
tag
+------+-------------+--------------+
| id | attach_id | content |
| 1 | 9 | alan-tag |
| 2 | 9 | second-tag |
+------+-------------+--------------+
I want to output this:
+-------+-----------------+-----------------------+
| name | email | content |
+-------+-----------------+-----------------------+
| alan | alan@me.com | alan-tag, second-tag |
+-------+-----------------+-----------------------+
Here's my best attempt at SQL for this:
SELECT customer.name, customer.email, tag.content
FROM customer
INNER JOIN tag
ON customer.id=tag.attach_id
GROUP BY customer.id,tag.content;
Is this even possible without first processing the data in another language like PHP?