Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql max of one field
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01412746
Message ID:
01412866
Vues:
63
Hi Folks, Thanks for all your replies.
I thought I would keep it simple by showing a sample where there were
just two fields... in reality there are more than the two fields.
I note that there is a different solution if there are more than 2 fields !!!
I'll take that into account.

Thanks again
Regartds.
Gerard



>>I have a table as follows with 2 columns :
>>CUS Date (Date field)
>>A 10 May
>>A 12 May
>>A 14 May
>>B 6 Jan
>>B 9 JUN
>>B 20 DEC
>>
>>Is there a Sql select which will select out all customers but with most recent date only
>>So I would require:
>>A 14 May
>>B 20 Dec only
>>
>>Tia
>>Gerard
>
>If you want to get ALL fields (or at least more than just these two) from that table for most recent date, and if you have MORE than just Customer and Date field:
>
>SELECT YourTable.*;
>FROM YourTable;
>INNER JOIN (SELECT Cus, MAX(DATE) AS Date;
>                   FROM YourTable;
>            GROUP BY Cus) Tbl1;
>      ON YourTable.Cus = Tb1l.Cus AND
>         YourTable.Date = Tbl1.Date;
>INTO CURSOR crsTest
>BROWSE NORMAL
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform