Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find the records with the earliest dates
Message
 
 
To
16/01/2003 09:39:23
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00742121
Message ID:
00742360
Views:
14
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform