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 |
|
rksingh024
Yak Posting Veteran
56 Posts |
Posted - 2002-04-17 : 06:02:32
|
| Hi,<<select au_lname from pubs..authorswhere au_lname like 'g%'>>will give you three rows. Is it possible to get the records in one row values separated by comma i.e. "Green,Greene,Gringlesby"Or can we write some concat function that works like a group function e.g. like sum, avg.RameshRamesh Singh |
|
|
VyasKN
SQL Server MVP & SQLTeam MVY
313 Posts |
Posted - 2002-04-17 : 06:23:45
|
| Here's one way of doing it:http://vyaskn.tripod.com/code.htm#cat--HTH,VyasCheck out my SQL Server site @http://vyaskn.tripod.com |
 |
|
|
rksingh024
Yak Posting Veteran
56 Posts |
Posted - 2002-04-17 : 06:45:26
|
| There is one line missing in my problem.I want to get the result in a single t-sql statement. So that I can use it in another select statement. e.g.<<select id,name, (select concat(skill_desc)from skills where employeeid=e.id) as skillsfrom employee e>>this should return me the resultset as-----------1 Abc sql,asp2 Pqr sql,vb,xml----------Ramesh Singh |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2002-04-17 : 07:50:40
|
| this problem has been answered here many times....search for CSV....there's even a FAQ on it! |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-04-17 : 08:16:09
|
| This should help:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=9978You CANNOT do the full concatenation in one SELECT statement, you need some kind of loop (not necessarily a cursor, but a loop nevertheless) The above link has several options that will provide the results you want. |
 |
|
|
|
|
|