MYSQL把查询多个的结果用逗号隔开,放在一个列里

mysql关键字:GROUP_CONCAT

  1. select name from 表1 t1 INNER JOIN 表2 t2 on t1.id=t2.word_id(关联字段)

结果:

2.select GROUP_CONCAT(name) from word t1 INNER JOIN relation_word_customer t2 on t1.id=t2.word_id

结果

 

from:https://blog.csdn.net/my_sweetxue/article/details/106380267