SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Covert row values into single column by group by
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bpuccha
Starting Member

34 Posts

Posted - 07/24/2013 :  13:14:08  Show Profile  Reply with Quote
Here is the query output by joing two tables

Name Addr Pcode amt1 amt2 policy_no trans_no r_no
a address T1B3Y3 10 100 800000000PAP 1 1
a address T1B3Y3 10 100 800000000PAP 1 2
b address T1B3Y3 10 100 800000000PAP 1 3
b address T1B3Y3 10 100 800000000PAP 1 4
b address T1B3Y3 10 100 800000000PAP 1 5
b address T1B4Y4 10 100 800000000PAP 1 6

I need output in the below format

Name Addr Pcode amt1 amt2 policy_no trans_no r_no
a address T1B3Y3 10 100 800000000PAP 1 1,2
b address T1B3Y3 10 100 800000000PAP 1 3,4,5
b address T1B4Y4 10 100 800000000PAP 1 6

I am using SQL server 2000..Is there any way that we can do this using a single query?

Edited by - bpuccha on 07/24/2013 13:14:47

madhivanan
Premature Yak Congratulator

India
22740 Posts

Posted - 07/29/2013 :  04:34:22  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Refer this http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000