Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find the records with the earliest dates
Message
 
 
À
16/01/2003 09:39:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00742121
Message ID:
00742360
Vues:
15
Mark,

Both of them sould work but subquery would be faster in most cases than correlated query.

>Sergey,
>
>Thanks, using the subquery works perfectly.
>
>
>>Mark,
>>
>>There'e a couple ways you can do that.
>>* Using subquery
>>SELECT driver_id, status, updt ;
>>  FROM temp2  ;
>>  WHERE driver_id + DTOS(updt) IN  ( ;
>>    SELECT driver_id + DTOS(MIN(updt)) ;
>>    FROM temp2  ;
>>    GROUP BY driver_id) ;
>>  INTO CURSOR crsResult
>>* Using correlated query
>>
>>SELECT driver_id, status, updt ;
>>  FROM temp2 tm1 ;
>>  WHERE updt IN  ( ;
>>    SELECT MIN(updt) ;
>>    FROM temp2 tm2 ;
>>    WHERE tm2.driver_id = tm1.driver_id) ;
>>  INTO CURSOR crsResult
>>
>>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform