How to Return the Maximum Value in a Database Field (117218)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft FoxPro for MS-DOS 2.0
- Microsoft FoxPro for MS-DOS 2.5
- Microsoft FoxPro for MS-DOS 2.5a
- Microsoft FoxPro for MS-DOS 2.5b
- Microsoft FoxPro for MS-DOS 2.6
- Microsoft FoxPro for Windows 2.5
- Microsoft FoxPro for Windows 2.5a
- Microsoft FoxPro for Windows 2.5b
- Microsoft FoxPro for Windows 2.6
- Microsoft FoxPro for Macintosh 2.5b
- Microsoft FoxPro for Macintosh 2.5c
This article was previously published under Q117218 SUMMARY
FoxPro does not provide a function for returning the maximum value stored
in a field in a database. However, FoxPro does provide the command verb
CALCULATE expr list> MAX() TO memvar. Although this command is useful, you
may need to call a function that will find and return the maximum value in
a field for a given condition. To do this, you can use the sample code
shown below, which returns the maximum value in a field in any specified
table for any given condition.
NOTE: There are several ways of writing this function; this is only one
example of how to write it.
Modification Type: | Major | Last Reviewed: | 12/3/2003 |
---|
Keywords: | kbcode KB117218 |
---|
|