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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Using Coalecense function for comma sep. in select

Author  Topic 

johnstern
Yak Posting Veteran

67 Posts

Posted - 2007-08-23 : 18:05:21
how can I use this fuction to agregate the rows of a column within a select statement

something like this

Select

LocationID,
(
DECLARE @EmployeeList varchar(100)
SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') +
CAST(Emp_UniqueID AS varchar(5))
FROM SalesCallsEmployees
WHERE SalCal_UniqueID = 1
SELECT @EmployeeList
) as employeeList,
address,
city
From USERS

johnstern
Yak Posting Veteran

67 Posts

Posted - 2007-08-24 : 10:21:22
would the only option be to make a user define funtion and then call it when making my main select statement ?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-25 : 01:43:24
Also if you use front end application, you can concatenate the data there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-25 : 03:52:22
Or read this topic
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=88403

Oh wait! That was a CROSS POSTING!



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -