Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Max
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01128148
Message ID:
01128153
Views:
21
Try
SELECT * FROM mytable mt1
  WHERE date = (SELECT MAX(date) FROM mytable mt2
                  WHERE mt2.MyKey = mt1.MyKey)
>I want to select out from a file, using a Group By Myfield , but want to get the most recent record if there are multiple records with the same Group by Key
>
>e.g.
>MyKey Date
>A Jan 10
>A Jan 15
>A Jan 08
>
>Select * group By MyKey and I want the second record to be selected
>Can this be done in a select command ?
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform