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 |
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2009-03-19 : 13:30:58
|
Hi i have two tables which on inner joining i get the result assaleman_id sales_task 234 clothes234 accessories234 kitchenryhow can i get this as one row in order to save row space.ex in this way :234---- clothes,accessories,kitchenry |
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-03-19 : 23:48:36
|
create userdefinedfunction to get thissee this linkhttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=121751 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-03-21 : 08:20:56
|
[code]Declare @TempTable Table( saleman_id INT, sales_task VARCHAR(Max))insert into @temptable select 234,'clothes'insert into @temptable select 234,'accessories'insert into @temptable select 234,'kitchenry' Declare @str VARCHAR(Max) , @str1 VARCHAR(Max) Select @str = '',@str1 = '' Select @str = @str + ',' + sales_task from @TempTable where saleman_id = 234 Select @str1 = 234select @str1,substring(@str,2,len(@str))[/code] |
|
|
|
|
|