Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
First and last based on same SQL
Message
De
09/10/2014 22:10:21
 
 
À
09/10/2014 15:30:56
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01609079
Message ID:
01609090
Vues:
34
>I would say this can be done with one select command with the use of MIN(), MAX(). However, I am not sure if this would always be adequate:
>
>
>SELECT MIN(Invoice.ApprovedPersonName) AS FirstOne,MAX(Invoice.ApprovedPersonName) AS LastOne
> FROM Invoice WHERE Invoice.NoClient=Client.Numero ORDER BY Invoice.AddDate
>
>

And as Antonio pointed out, the FROM (or JOIN) needs to reference the Client table.

Unless what you're writing here is intended to be a correlated subquery, where the reference to Client is an outer reference....but again, if you can clarify what you're trying to do, that would probably help.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform