Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Rows in 1 Row 2

Status
Not open for further replies.

Cobby1812

IS-IT--Management
Jun 22, 2006
58
GB
Hi there,

I am trying to return some data in Transact SQL. The small example table below shows the core data and the Example OutPut shows what I am trying to achieve. I want one row per Client however I cant think of a way to do this. Any ideas anyone.
Example Date

ClientNo SystemID Facility

0000002/001 0000002 Payments
0000002/001 0000002 Cheques
0000002/001 0000002 CHAPS
0000002/001 0000002 BACS
0000002/001 0000002 Cash

OutPut Data
SystemID Facility
0000002 Payments,Cheques,CHAPS,BACS,Cash
 
Did you try to PIVOT your data?

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
If what you're trying to do is create a single field with all those items comma-separated, take a look at the GROUP_CONCAT() function.

Tamar
 
I used STRING_AGG instead in the end - works lovely.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top