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 |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2009-11-26 : 17:12:38
|
| Hi,I have a query I am trying to write, basically its like this.Select photoID FROM tblPhotosIts very simple, but instead of it bringing back a bunch of rows, I want it to bring back a column that is the list of photoID's with a comma between them.For exampleInstead ofphotoID12345I want to bring backphotoString1,2,3,4,5Any thoughts on how I can do this ? I am doing this way because I want the data formatted like this for my web app, to pass into a js function. Also because I want to bring back a better data footprint for my query.Thanks very much!mike |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2009-11-26 : 22:09:50
|
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254 Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
|
vikky
Yak Posting Veteran
54 Posts |
Posted - 2009-11-27 : 02:11:02
|
| hi,select stuff((select ','+cast(photoid as varchar(10)) from yourtable for xml path('')),1,1,'')Thanks,vikky. |
 |
|
|
|
|
|
|
|