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
 Need new column with SUM of text, not numbers

Author  Topic 

MGarriga
Starting Member

5 Posts

Posted - 2009-08-12 : 12:54:44
Hi,
Simplifying, I have a table that looks something like this,
Client Amount Description Year
1 10 a 2000
1 10 b 2001
2 10 a 2000
2 10 c 2000
3 10 d 2001

and I want:
Client
1 10 a 2000
1 10 b 2001
2 20 a , c 2000
3 10 d 2001

How can I add the different text in the rows for a given year in a single "cell" ?

Thank you,
Montse

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-08-12 : 13:23:50
By creating a function to concatenate the values for 1 group. Then using the function for all the groupings.

Read through this post (as well as some the contained links) for a solution:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=53293

EDIT:
Alternative approach and a lot more discussion here:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254


Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -