Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Concatenate by Grouping Expand / Collapse
Author
Message
Posted Friday, October 25, 2013 10:46 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 1:39 PM
Points: 158, Visits: 616
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
Post #1508528
Posted Friday, October 25, 2013 11:22 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 7:51 PM
Points: 3,354, Visits: 7,251
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.



Luis C.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1508541
Posted Friday, October 25, 2013 12:01 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 1:39 PM
Points: 158, Visits: 616
Actually after a bit more digging I was able to find the answer here:

[url=http://www.sqlservercentral.com/Forums/Topic872409-392-1.aspx][/url]
Post #1508558
Posted Monday, October 28, 2013 2:59 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 7:51 PM
Points: 3,354, Visits: 7,251
It's the same way, but you should read the article (it's not long) to understand how does it work.


Luis C.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1509122
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse