Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can this be done in one SQL Select?
Message
De
08/02/2005 15:09:30
Jim Winter
Jim Winter Consulting
Hinesburg, Vermont, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00984864
Message ID:
00984875
Vues:
26
>I need help in selecting records from the following table (simplified):
>
>CUST_ID
>ORD_DATE
>ORD_TIME
>
>For a given date (ORD_DATE), I need to select one order record per customer (CUST_ID) based on the time of order (ORD_TIME). For example, the Order Time should be the latest of the day.
>
>I would appreciate any suggestions.
>
>Thank you.

Dmitry,

Not tested, but would this work?
SELECT Cust_ID, MAX(Ord_Time) ;
  FROM MyTable ;
 WHERE Ord_Date = ?vp_OrdDate ;
 GROUP BY Cust_ID
HTH,
Jim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform