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 |
mahdi87_gh
Yak Posting Veteran
72 Posts |
Posted - 2010-09-28 : 03:45:29
|
hii have this queryselect distinct moghaser from Tasadof and the results will bemoghaser--------------najasalesmoshtarekhow can i concat this rows like this: naja,sales,moshtarekthank u****<< I Love MTN.SH >>**** |
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-09-28 : 04:06:32
|
You can achieve this using pivot operator. |
 |
|
Sachin.Nand
2937 Posts |
Posted - 2010-09-28 : 04:57:10
|
[code]declare @tbl as table(val varchar(40))insert into @tblselect 'selectnaja'union select 'sales'union select 'moshtarek'declare @val varchar(max)=''select @val=@val +',' + val from @tblselect stuff(@val,1,1,'')[/code]PBUH |
 |
|
mahdi87_gh
Yak Posting Veteran
72 Posts |
Posted - 2010-09-28 : 14:04:44
|
thanks dude****<< I Love MTN.SH >>**** |
 |
|
|
|
|