티스토리 뷰

공부

GROUP_CONCAT

승가비 2024. 7. 29. 00:44
728x90
  SELECT GROUP_CONCAT(hobbies SEPARATOR ', ') 
  FROM peoples_hobbies 
  WHERE person_id = 5 
  GROUP BY 'all';

https://stackoverflow.com/questions/276927/can-i-concatenate-multiple-mysql-rows-into-one-field

 

Can I concatenate multiple MySQL rows into one field?

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: shoppi...

stackoverflow.com

 

728x90
댓글