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 |
joshherman
Starting Member
13 Posts |
Posted - 2011-06-20 : 02:42:04
|
tabel1------col1----ABtabel2------fk desc-------------A XA YA ZB XB Yi want to create report likecol1 Desc---- ----A X,Y,ZB X,Yhow the solution for it ?thank |
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2011-06-20 : 02:54:10
|
If you are using Sqlserver 2005 or greaterSELECT pm.fk,(SELECT P.[desc] + ','FROM tab P WHERE P.fk = PM.fkORDER BY P.[desc] FOR XML PATH('')) as colu_nameFROM table2 AS PM group by pm.fk;Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
|
|
joshherman
Starting Member
13 Posts |
Posted - 2011-06-20 : 03:40:54
|
ok :) thank you |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2011-06-20 : 03:57:24
|
quote: Originally posted by joshherman ok :) thank you
Welcome Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
|
|
|
|
|