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 2000 Forums
 Transact-SQL (2000)
 Sum a Varchar

Author  Topic 

ryager
Starting Member

3 Posts

Posted - 2007-08-29 : 09:19:22
Hello All,

I have a table (ATable) that contains the following

(int) (varchar)
UserID Company
1 ABC
1 DEF
1 GHI
2 ABC
2 DEF
3 ABC

and I am trying to create a view that looks like

UserID Companies
1 ABC,DEF,GHI,
2 ABC,DEF,
3 ABC,



I've tried->

select
UserID,
Sum(Company + ',')
from
ATable
group by
UserID

However the Varchar datatype is incorrect for the SUM.

Any idea how to do this?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-29 : 09:32:47
Cross post
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=88605



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

- Advertisement -