Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Picking maximum date from group of accounts
Message
 
À
30/03/1998 15:42:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00088209
Message ID:
00088348
Vues:
27
>Hey everyone, sorry if this is such a novice question, but I am having problems trying to pick a subset of accounts from data that looks like the following:
>
>acct# agmt date name
>123 12/10/91 john smith
>123 12/10/96 john ross
>321 01/20/91 mary kay
>321 01/20/96 mary jones
>
>I want to just select the account#'s which have the latest 'agmt date'. I have tried the following but it is not reliable when working with a large subset of data and many (sometimes 8 or more) account numbers:
>
>sele *, max(agmt_date) from xxxx group by acct#
>
>Any help is appreciated greatly!!


If you want the last date for each acct#.

SELECT * FROM xxxx GROUP BY acct# ORDER BY acct#,agmt_date DESCENDING

Mike
Michael McLain
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform