我哈瓦表
MsgID Msg value
ms001 I am here. ----
ms001 Wher are you dsdad
ms002 who r u gfsdfdf
ms002 where is this dadad
ms002 I am goin adadad
这可以通过MySQL查询得到这样的结果
ms001 I am here. Wher are you
ms002 who r u wher is this I am goin
答案 0 :(得分:6)
<强> Read about group_concat 强>
SELECT MsgID , GROUP_CONCAT(Msg SEPARATOR ' ') AS Msg
FROM table1
GROUP BY MsgID;
<强> SQL Fiddle 强>