AndrewMozley
Programmer
I need to find the largest value of the date in a certain set of records in a VFP table. At present I do something like this (it works).
[Blue]LOCAL lProd, lDate
USE mytable
SELECT mytable
SET ORDER TO TAG Prodcode
lDate = CTOD("01/01/1900")
lProd = PADR("PROD1",20)
SEEK lProd
SCAN WHILE mytable.prodcode = lProd
IF mytable.date > lDate
lDate = mytable.date
ENDIF
ENDSCAN[/Blue]
I feel that I ought to be using an SQL statement to do this, but up to now I have only ever used SELECT (SQL) to create a cursor, something like :
[Blue]SELECT this, that, the_other FROM somefile INTO CURSOR mycursor[/Blue]
Is there a more efficient way of finding out my latest date (using SQL)?
[Blue]LOCAL lProd, lDate
USE mytable
SELECT mytable
SET ORDER TO TAG Prodcode
lDate = CTOD("01/01/1900")
lProd = PADR("PROD1",20)
SEEK lProd
SCAN WHILE mytable.prodcode = lProd
IF mytable.date > lDate
lDate = mytable.date
ENDIF
ENDSCAN[/Blue]
I feel that I ought to be using an SQL statement to do this, but up to now I have only ever used SELECT (SQL) to create a cursor, something like :
[Blue]SELECT this, that, the_other FROM somefile INTO CURSOR mycursor[/Blue]
Is there a more efficient way of finding out my latest date (using SQL)?