Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00197746
Message ID:
00197815
Vues:
15
>Dan,
>
>Thanks for the help. The syntax you provided
>worked, but I'v come up with a twist on it:
>
>The table has multiple records for each person.
>I want to pull only the LATEST record of any given
>last name. I have a numeric sequence field that I
>use for ordering.
>
>Will the the syntax you provided still work?
>
>Again, I need Id, Lastname, FirstName but only
>the lastest for each person.
>
>Your thoughts?
Try something like:

select id, lastname, firstname ;
FROM mytable a;
WHERE id IN ;
(SELECT TOP 1 id ;
FROM mytable b;
WHERE b.lastname = a.lastname ;
GROUP BY LName ;
ORDER BY OrderField DESC)
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform