2016-05-25 7 views
0

はあなたの助けのためののMySQL、SELECT結果のグループ行が

| firstfield | secondfield | types 
    firstvalue secondvalue 1,2,3 

代わりの

| firstfield | secondfield | type 
    firstvalue secondvalue 1 
    firstvalue secondvalue 2 
    firstvalue secondvalue 3 

おかげのような何かを得るために、選択クエリで、それが可能です。

答えて

1

あなたはgroup_concatを使用することができます。

select firstfield, secondfield, GROUP_CONCAT(type order by type) as types 
from yourtable 
group by firstfield, secondfield; 
関連する問題