Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with SP
Message
De
11/11/2013 08:58:35
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Versions des environnements
SQL Server:
SQL Server 2000
Application:
Web
Divers
Thread ID:
01587728
Message ID:
01587733
Vues:
58
>Hi all, I need to retrieve the largest value from one of my tables in SS, my code is shown below
>
>
>Select ClaimRef,max(Claim.AdmittedValUSD) as admval from claim
>group by ClaimRef
>
>
>
>I expected to get 1 record but receive thousands ? any idea why ?
>ClaimRef is unique PK

You get thousands records because ClaimRef is unique.
If you want to get MAX(Claim.AdmittedValUSD) over ALL records you must use:
Select MAX(AdmittedValUSD) as admval
from claim
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform