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)
 fancy sql

Author  Topic 

sqlnige
Starting Member

1 Post

Posted - 2006-06-13 : 06:12:50
Hey folks,

I'd really appreciate if someone can tell me if this is possible and how I would structure a statement:

I have 1 table:

user / code
------------

nigel / 123
nigel / 424
nigel / 137
john / 651
mary / 651
mary / 189


I want an sql statemnet to give me this result:

user / codes
------------

nigel / 123, 424, 137
john / 651
mary / 651, 189

the codes don't have to have a seperate field and could be concatenated together and have a comma to seperate them.

Any ideas,

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2006-06-13 : 06:39:00

http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx


Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2006-06-13 : 06:40:34
see this link..
http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx?Pending=true
Go to Top of Page

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2006-06-13 : 06:57:31




Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page
   

- Advertisement -