Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use Max() is SQL
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00986746
Message ID:
00986750
Views:
33
>I am to use the MAX() function in an SQL statement. Keying on the maximum date in the PKGDATE field. But is not working, do anyone have any suggestions on how I can do this. See example below.
>
>SELECT DISTINCT SUBSTR(pkgname,1,3), pkgdate, clientver FROM Pkgsrcvd INTO TABLE LAST_TRANSMITTED ;
>WHERE MAX(PKGDATE) AND !EMPTY(clientver) ORDER BY 1
>
>
>Thank You In Advance
>
>
>
>Winfred Majors

Not sure if I understood correctly, Something like this?

ldKeyedMaxDate=SomeDate()
select SUBSTR(pkgname,1,3) as pkgname, clientver, max(pkgdate) as maxpkgdate from Pkgsrcvd INTO TABLE LAST_TRANSMITTED ;
group by 1, 2 having maxpkgdate=ldKeyedMaxDate
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform