Reputation: 25
For Example This is my table(copied).
id customer product
1 Tizag Pen
4 Gerald Garner 19" LCD Screen
5 Tizag 19" LCD Screen
6 Gerald Garner clock
I want to select the whole table. And the result has to be like this:
customer product
Tizag Pen,19" LCD Screen
Gerald Garner 19" LCD Screen,clock
How can I do this?
Upvotes: 2
Views: 99
Reputation: 3694
No need to use "," as seperator , it comes by default
select customer, group_concat(product) as product
from tableName
group by customer
Upvotes: 1
Reputation: 8119
Select customer ,
Group_Concat(product SEPARATOR ',') as Product
from TableName group by customer
Upvotes: 3