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.
| Author |
Topic |
|
sqldba2k6
Posting Yak Master
176 Posts |
Posted - 2006-08-04 : 14:09:36
|
| I need help in getting the desired output.Declare @Temp Table(id int,SomeValue VarChar(2))Insert Into @Temp(id,SomeValue) Values (14, 10) Insert Into @Temp(id,SomeValue) Values (14, 20)Insert Into @Temp(id,SomeValue) Values (14, 30) Insert Into @Temp(id,SomeValue) Values (15, 10) Insert Into @Temp(id,SomeValue) Values (15, 20)Insert Into @Temp(id,SomeValue) Values (15, 30)Declare @Result VarChar(8000)Select @Result = coalesce(@Result+','+SomeValue, @Result, SomeValue) From @TempSelect @ResultDesired Results------------Id Somevalue-- --------14 10,20,3015 10,20,30 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
|
|
|
|
|
|
|