Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to compare and update master table?
Message
From
04/05/2006 15:53:39
 
 
To
04/05/2006 15:35:48
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows Server 2003
Miscellaneous
Thread ID:
01119103
Message ID:
01119355
Views:
22
This message has been marked as a message which has helped to the initial question of the thread.
>Change one of "Val 3" by another value... and it will not be present in your crsTest.

No it will not, It just compares Key fields. It is easy when you work with tables with just two fields to include them both in join condition, but I doubt you have such case.
lcSql  = [SELECT ]
lcJoin = []
FOR lnFor = 1 TO FCOUNT([MasterTable])
    lcFld   = FIELD(lnFor,[MasterTable])
    lcSql   = lcSql   + IIF(lnFor = 1, [],[,]) + [NVL(MasterTable.]+lcFld+[, TempTable.]+lcFld+[) AS lcFld]
    lcJoin  = lcJoin  + IIF(lnFor = 1, [],[ AND ]) + [MasterTable.]+lcFld+[ == TempTable.]+lcFld
NEXT
lcSql   = lcSql + [ FROM MasterTable ]+;
                  [FULL JOIN TempTable ON ]+lcJoin+;
                  [ WHERE MasterTable.KeyFld IS NULL OR TempTable.KeyFld IS NULL]+;
                  [ INTO CURSOR crsTest]
&lcSql
SELECT crsTest
BROW NORMAL
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