.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

Need a query for sql server 2000

Posted By: Senthilnathan     Posted Date: September 13, 2011    Points:5   Category :Sql Server
Hi,

I need a query for below for sql server 2000.

table structure:

col1 Col2
1 a
2 b
1 c
2 d
1 e
3 f

Out put should be like this:

col1 col2
1 a,c,e
2 b,d
3 f

Please help me on this.

Responses
Author: Sasi Prabhu             
Posted Date: September 13, 2011     Points: 20   

Try :

SELECT t.id, 
t.description
STUFF(ISNULL(SELECT ', ' + x.releateid
FROM TABLE x
WHERE x.id = t.id
AND x.description = t.description))
FROM TABLE t




Thanks & Regards,
Sasi Prabhu.
Author: Sasi Prabhu             
Posted Date: September 13, 2011     Points: 20   


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend