October 25, 2013 at 10:46 am
Does anyone have any ideas on how to concatenate cells by a grouping of rows? The data below shows original and an example of how I'm trying to combine. Also attached an image of a table I put together with the same data.
Current Data
Agent Item Email
Aaron 123 abc@abc.com
Aaron 1256 def@def.com
Aaron 1256 ghi@ghi.com
Ben 143 jkl@jkl.com
Ben 143 mno@mno.com
Carl 156 pqr@pqr.com
Carl 156 stu@stu.com
Carl 156 vwx@vwx.com
Combined
Agent Item Emails
Aaron 123 abc@abc.com
Aaron 1256 def@def.com; ghi@ghi.com
Ben 143 jkl@jkl.com; mno@mno.com
Carl 156 pqr@pqr.com; stu@stu.com; vwx@vwx.com
Owner & Principal SQL Server Consultant
Im Your DBA, Inc.
https://www.imyourdba.com/
October 25, 2013 at 11:22 am
It's really easy, just follow the instructions on this article:
http://www.sqlservercentral.com/articles/comma+separated+list/71700/
For a coded answer, please provide DDL and sample data in the form of insert statements.
October 25, 2013 at 12:01 pm
October 28, 2013 at 2:59 pm
It's the same way, but you should read the article (it's not long) to understand how does it work.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply