Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00197746
Message ID:
00197815
Views:
14
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform