.net - SQL loop problem -


I have a problem, I hope someone can help it. I'm not really good at programming SQL I need help from u friends

My problem is, I have a customer code that is possible for 2 or 3 addresses Sample:

  cust1 address1 cust1 address2 cust1 address3 cust2 address1 cust2 address2  

I want to generate a report in .net to be like this:

  cust1 address 1 address 2 address 3 cust2 address 1 address 2  

Can anyone help?

It assumes 2 tables:

  select the customer , A1. Address + '' + A2 Address + '' + A3 As A1 on A1 CustKey = C.CustKey Enter the address as A2 in the form of internal A2. CustKey = C.CustKey and A1.AddressKey & lt; & Gt; A 2. Addressers have joined the address as A3 on A3. Caste = c. Castky and A3 The address & lt; & Gt; A1.AddressKey and A3.AddressKey & lt; & Gt; A2.AddressKey  

Edit to show:

This table considers:

  select A1. Customer, A1Editor + "A 2.Editor +" A3. Contact A customer as A1 As A2, enter the customer as A2 in the form of A2. Caste = A. Custody and A1 Address & lt; & Gt; A2 As a customer on address A3, joined on A3. Caste = A. Caste and A. 3. Andres & lt; & Gt; A1. Address and A3 Address & lt; & Gt; A2.Address  

Comments