Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Only return 1 row for join
Message
De
16/01/2013 09:51:01
 
 
À
16/01/2013 08:08:42
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01562935
Message ID:
01562964
Vues:
33
>Hi
>
>I can't remember how to do this.
>
>I have two tables with a join
>
>Table Contact has multiple rows for each row in table Individual.
>
>I only want to return the earliest row in table Contact for each row in Table Contact. Each row in table contact has a created date and they are joined on individual_ref
>
>How do I do that ?
>
>Thanks
SELECT * FROM Individual I
                 OUTER APPLY (SELECT TOP 1 * FROM Concact C ON C. individual_ref = I.refkey ORDER BY date)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform