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 |
|
vmurali
Yak Posting Veteran
88 Posts |
Posted - 2007-01-25 : 04:19:14
|
| I have a table like below.certid name 1 xxx 1 yyy 1 cvbnow I want to output as xxx,yyy,cvb when i pass input certid=1I want to get it using a single query statement |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-25 : 04:22:47
|
| select distinct certid, dbo.fnConcat(certid, ',')select dbo.fnConcat(1, ',')there are plenty of concat functions here at sqlteam.Peter LarssonHelsingborg, Sweden |
 |
|
|
vmurali
Yak Posting Veteran
88 Posts |
Posted - 2007-01-25 : 04:53:43
|
| I am using SQL 2005. your reply is not helping me. Please send me the query. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-25 : 05:00:17
|
| My reply is helping you a lot!Or is your reply/comment a lame excuse to not want to learn SQL? Is this a homework?Please search SQLTeam. If you are too lazy, click here [url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=53293[/url]Peter LarssonHelsingborg, Sweden |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
vmurali
Yak Posting Veteran
88 Posts |
Posted - 2007-01-25 : 06:00:14
|
| See What I meant was that I had to get the result using single simple query and not using any Stored Procedure. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-25 : 06:05:53
|
| No one here ever suggested a stored procedure to you.Peter LarssonHelsingborg, Sweden |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-25 : 06:07:21
|
| [code]Declare @out varchar(max)Select @out = coalesce(@out + ',', '') + [name]from tblwhere certid = 1Select @out[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|
|
|