Can I concatenate multiple MySQL rows into one field?
Posted
by Dean
on Stack Overflow
See other posts from Stack Overflow
or by Dean
Published on 2008-11-10T02:34:26Z
Indexed on
2010/05/17
19:50 UTC
Read the original article
Hit count: 206
Using MySQL, I can do something like
select hobbies from peoples_hobbies where person_id = 5;
and get:
shopping
fishing
coding
but instead I just want 1 row, 1 col:
shopping, fishing, coding
The reason is that I'm selecting multiple values from multiple tables, and after all the joins I've got a lot more rows than I'd like.
I've looked for a function on MySQL Doc and it doesn't look like the CONCAT or CONCAT_WS functions accept result sets, so does anyone here know how to do this?
© Stack Overflow or respective owner