Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select Max
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01128148
Message ID:
01128153
Vues:
25
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform