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:
01412755
Vues:
61
>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
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform