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:26:54
 
 
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:
00984884
Vues:
34
This message has been marked as the solution to the initial question of the thread.
No gurantee but this should give you some ideas:

select KEYFIELD, CUST_ID as CUSTOMER, ORD_DATE, ORD_TIME ;
from ORDERTABLE ;
where KEYFIELD in ;
(select top 1 KEYFIELD from YOURTABLE
where CUST_ID == CUSTOMER
order by ORD_DATE, ORD_TIME descending)
order by CUSTOMER

HTH

Peter


>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.
Peter Robinson ** Rodes Design ** Virginia
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform