Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert command into sql query
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01281878
Message ID:
01281964
Views:
7
>>thank Naomi and serg(now i am shacking my head to understand you codes.
>
>Glancing through your original code it seems to be that you wanted to insert new records from students into ExamTran if the code was not found and update ExamTran records certain fields with the information from other fields of the same table.
>
>If this is so, I first selected records matching your original criteria (SET FILTER command).
>
>
>Basically your code may be also re-written this way:
>
>update ExamTran set onefield = '', another field = combination of fields where exists (select * from Student where your filter criteria)
>
>select code,"StaticInfo" as OneExtraField from students where code not in (select code from ExamTran) into cursor curToInsert && or LEFT JOIN equavalent which is usually faster
>
>insert into ExamTran (code, OneField) select * from curToInsert
Or even easier
insert into ExamTran (code, OneField);
select code,"StaticInfo" as OneExtraField from students where code not in (select code from ExamTran)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform