Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Syntax
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00948594
Message ID:
00948613
Views:
14
This message has been marked as a message which has helped to the initial question of the thread.
>select personno, category, level from misshist;
>  where personno + dtoc(fromdate,1) in;
>  (select personno + dtoc(min(fromdate),1) from misshist where category = 'R' group by personno)
>Is there any cleaner way to accomplish this?

That looks pretty clean to me, actually. Another possibility would be a correlated subquery. Without actually testing the code, it would look something like:
SELECT personno, category, level ;
    FROM misshist M1 ;
    WHERE fromdate IN ;
        (SELECT MIN(fromdate) ;
            FROM misshist M2 ;
            WHERE category = "R" ;
              AND m1.personno = m2.personno)
I don't remember offhand if this syntax works before VFP9, and I'm not at my desk to check right now.

Updated update: Since Sergey posted almsot the ssame code a couple of minutes before me, I'll assume it's more-or-less correct. :-)
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Previous
Reply
Map
View

Click here to load this message in the networking platform