Nikhil Mishra
Nikhil Mishra

Reputation: 407

concatenate strings of rows according to column

I hava table

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

Is this possible to get result like this by MySQL query

ms001    I am here. Wher are you
ms002    who r u wher is this I am goin  

Upvotes: 0

Views: 88

Answers (1)

Prahalad Gaggar
Prahalad Gaggar

Reputation: 11599

Read about group_concat

SELECT MsgID , GROUP_CONCAT(Msg SEPARATOR ' ') AS Msg
FROM table1
GROUP BY MsgID;

SQL Fiddle

Upvotes: 6

Related Questions