Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL max() and corresponding fields
Message
De
14/07/1999 13:48:34
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
SQL max() and corresponding fields
Divers
Thread ID:
00241387
Message ID:
00241387
Vues:
60
Is it possible to get the maximum value from a field and other fields corresponding to the same record?

i.e: Given a table with OrderNumber, CustId and total_Price, How do I get the highest total_price for every CustId and the Corresponding OrderNumber in a single query?

I´ve tried something like:
Select CustId, OrderNumber,max(total_price) from [Tablename] group by CustId

It returned the maximum value of "total_price" for every CustId, but the "OrderNumber" returned is not correct, given that in the source table the total_price for that Order_Number is not the same.

Tks
There´s a better life... Just it´s more expensive!
Cristóbal Manrique M.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform