mysql - Sql Merging multiple records into one record -
i have table 2 columns user_id , tags.
user_id tags 1 <tag1><tag4> 1 <tag1><tag2> 1 <tag3><tag2> 2 <tag1><tag2> 2 <tag4><tag5> 3 <tag4><tag1> 3 <tag4><tag1> 4 <tag1><tag2>
i want merge 2 records 1 record this.
user_id tags 1 tag1, tag2, tag3, tag4 2 tags, tag2, tag4, tag5 3 tag4, tag1 4 tag1, tag2
how can this? can me out. need convert tags field array []. don't have knowledge on typical sql commads. know basics. ruby on rails guy.
you should group_concat function in mysql.a example here
in case like:
select user_id, group_concat(tags) tablename group user_id
Comments
Post a Comment