I have a table Managers. Columns: ManagerId, ManagerName.
I have a table Clients. Columns: ClientId, ManagerId, ClientName, ClientAddress, Details.
Each (every?) manager have clients in clients table.
I need a query that returns next table. Columns: Column1, Column2.
Column1: ManagerName
Column2: ClientName1 ',' ClientAddress1 ',' Details1 ';' ClientName2 ',' ClientAddress2 ',' Details2 ';' etc
In column2 just a list of clients which correspond to manager from column1.
How can I do that?
I guess I need to use COALESCE but I’m not sure.
Here is a working example using
XML AUTOThe output will look like this