Sql Merging multiple records into one record

后端 未结 3 1424
一个人的身影
一个人的身影 2021-01-28 12:33

I have table with two columns user_id and tags.

  user_id    tags
    1    
    1    
    1    

        
3条回答
  •  独厮守ぢ
    2021-01-28 13:25

    You should look into the GROUP_CONCAT function in mysql.A good example is here

    In your case it would be something like:

    SELECT user_id, GROUP_CONCAT(tags) FROM tablename GROUP BY user_id
    

提交回复
热议问题