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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select list split by comma

Author  Topic 

jimmy2090
Starting Member

26 Posts

Posted - 2014-10-29 : 07:04:03
Hi all,

i have a list of data as below:

Company Email
A AAA@abc.com
A BBB@abc.com
B xxx@def.com

i would like to write a query to list out as below where select the company A
AAA@abc.com, BBB@abc.com, ...

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2014-10-29 : 07:16:59
Declare @stremail varchar(max)
select @stremail =coalesce(stremail+',','')+email from yourtable
select @stremail

Javeed Ahmed
https://www.linkedin.com/pub/javeed-ahmed/25/5b/95
Go to Top of Page

jimmy2090
Starting Member

26 Posts

Posted - 2014-10-29 : 07:29:16
thank, it solved.
Go to Top of Page
   

- Advertisement -