Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi All,I have a table Contacts, which contains a list of address book contacts. One of the fields is called ContactLabelID, which is just an integer which links to an ID field in the ContactLabels table. Within the ContactLabels table, I can have several rows that are associated with a row in the Contact table, each with a unique label. Now if I just do a plain inner join on the Contacts and ContactLabels tables on the ContactLabelID field, I will have duplicate contact rows, each with a unique label field. How do I go about writing a stored procedure where I can query all the contacts, and have the contact labels as a new, comma separated column in the resulting data set?Thanks.