Listing mysql row entries from tags into one single row
Posted
by Derrick
on Stack Overflow
See other posts from Stack Overflow
or by Derrick
Published on 2010-05-03T21:51:30Z
Indexed on
2010/05/03
21:58 UTC
Read the original article
Hit count: 308
mysql
|mysql-query
Hi guys, Ive got two tables, one a listings and another representing a list of tags for the listing table.
In the listings table the tag ids are stored in a field called tags as 1-2-3- this has worked out very well for me regular expressions and joins to seperate and display the data, BUT... I now need to pull the titles of those tags into a single row. See below.
listings table
id tags
1 1-2-3-
2 4-5-6-
tags table
id title
1 pig
2 dog
3 cat
4 mouse
5 elephant
6 duck
And what I need to produce out of the listings table is:
id tags
2 mouse, elephant, duck
any suggestions?
© Stack Overflow or respective owner