Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the MAX function
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01509686
Message ID:
01509688
Views:
55
>I am wondering how I can get the record for a certain MemberID; there are several records of termination for this one person, and they are valid because the person had insurance coverage at various points in time and eventually allowed his coverage to Terminate for one reason or another. I have to fin the record having the MAXIMUM Termination_Date.
>
>I tried using the MAX(Term_Date) function in the HAVING clause but it doesn't have enough arguments, and doesn't seem to apply there.
>
>It seems that MAX in FoxPro and T-SQL are a bit different.

VFP SQL MAX() functions is the same as TSQL. VFP procedural one is totally different.
SELECT * From TheTable mt 
  WHERE WhateverDate = (SELECT MAX(WhateverDate) FROM TheTable WHERE MemberID = mt.MemberID)
     AND MemberID = ...
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform