Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get max() record?
Message
De
16/01/2004 05:53:36
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
How to get max() record?
Divers
Thread ID:
00867397
Message ID:
00867397
Vues:
52
Hi,
I would like to get largest sales amount records for each day. I use the following SQL, it return correct largest sales amount field value, but always last salesno. Any ideas?
SELECT SalesNo, SalesDate, MAX(Amount) AS MaxAmount ;
FROM Sales ;
GROUP BY 1, 2 ;
INTO CURSOR csrMax

Data:
SalesNo     SalesDate         Amount
A00001      01/01/2003        100
A00002      01/01/2003        200
A00003      02/01/2003        100
A00004      01/01/2003        100

Expected Result:
A00002      01/01/2003        200
A00003      02/01/2003        100

Wrong Result returned by SQL above
A00004      01/01/2003        100
A00003      02/01/2003        100
Please advise
I am not the most powerful man in this world.
I am not the worst man in this world either.
I just as same as all of you.
I still need to learn from my mistakes...
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform