Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get max() record?
Message
From
16/01/2004 05:53:36
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
How to get max() record?
Miscellaneous
Thread ID:
00867397
Message ID:
00867397
Views:
53
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...
Next
Reply
Map
View

Click here to load this message in the networking platform