LMSouq
database Open

Can I concatenate multiple MySQL rows into one field?

DE
Dean Rather
1 month ago
3 views
Problem Description
Using `MySQL`, I can do something like: SELECT hobbies FROM peoples_hobbies WHERE person_id = 5; **My Output:** shopping fishing coding but instead I just want 1 row, 1 col: **Expected Output:** 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 <a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws">MySQL Doc</a> and it doesn't look like the `CONCAT` or `CONCAT_WS` functions accept result sets. So does anyone here know how to do this?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base