Let's assume I have the following table:
-- 1. Create table 'Store'
CREATE TABLE Store
(
Customer int,
Product varchar(50)
);
-- 2. Add values to the table:
INSERT INTO Store
VALUES (1, 'Carrot'),
(1, 'Milk'),
(1, 'Bread'),
(1, 'Eggs'),
(2, 'Water'),
(2, 'Juice'),
(2, 'Wine'),
(2, 'Coffee'),
(3, 'Chicken'),
(3, 'Tea');
I want to change the table in order to see all customer's products in one row like shown below:
Customer | Products |
---|---|
1 | Carrot,Milk,Bread,Eggs |
2 | Water,Juice,Wine,Coffee |
3 | Chicken,Tea |
Thanks in advance for your help!