Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

node.js - How to combine rows with same ID but different values in certain columns in mysql

id name age gender hobby
1 Max 20 Male Skating
1 Max 20 Male Running
1 Max 20 Male Jogging
2 Tom 24 Male Skating
3 Mary 22 Female Dancing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could try using group_concat()

 select id, name, age, gender, group_concat(hobby) 
 from my_table 
 group by id, name, age, gender

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...