This article explains how to concatenate rows using SQL into one field.
This example is based on a website that uses tags to relate articles and is using a MySQL database. An article will have multiple tags and each tag is in a row in the tags table. By grouping an article by the news_id field this will return more that one row if the article has many tags. The issue now is you only want to return a single row as the article with the tags nicely grouped together in one field. This can be achieved by using Group_Concat() method which requires the field name to be concatenated. By default each row is separated by a comma but this can be changed by entering a SEPARATOR and then the character straight afterwards.
SELECT story.*, GROUP_CONCAT(tags.tag) as tagGroup FROM story LEFT JOIN tags ON tags.news_id = story.news_id WHERE story.news_id = 13 GROUP BY story.news_id
The example above shows one way to use Group_Concat()
GROUP_CONCAT(tbl_list SEPARATOR '-')
This shows how to change the default separator.
This method can be used in other ways to concatenate items, to read further see Group_Concat() dev.mysql.com.

