Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Left joins in one row
Message
De
27/05/2003 22:47:34
 
 
À
27/05/2003 19:51:34
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00793316
Message ID:
00793338
Vues:
30
this is a very common request and there is no easy way to do it in TSQL. You can use the FOR XML option to return an XML fragment containing the information:
<customer id="10">
 <phones>
  <phone>954-565-5496</phone>
  <phone>954-549-6446</phone>
 </phones>
...
</customer>
-Mike

>I have this problem.
>
>Let's say I have a customer table and I'm joining to a customer_phones table and also to an customer_nicknames table.
>
>Now I want the result to look like this, somehow combining the phone numbers into one field and combining the nicknames into another field, basically one row per customer.
>
>nCus_id: 10
>cPhones: '954-546-5496,954-549-6446'
>cNickNames: 'rico,tommy,rock'
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform