Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update a template table
Message
 
 
To
31/07/2007 10:29:51
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01244862
Message ID:
01244863
Views:
20
>Hi all,
>
>I have a template table :
>
>template.dbf
>empno balance
>
>11111
>22222
>33333
>44444
>
>with the data from temporarily table:
>
>temptable.dbf
>empno balance
>
>11111 10000
>44444 20000
>
>to update the above template.dbf table to have the results finally as:
>
>template.dbf
>empno balance
>
>11111 10000
>22222 0
>33333 0
>44444 20000
>
>TIA.

Hi Paul,

Assuming VFP9 you may use this syntax:
update Template set Balance = temp.Balance from Template ;
inner join TempTable Temp on Template.EmpNo = Temp.EmpNo
If you didn't have 0 in non-matched records and you want to reset them now to 0, use this:
update Template set Balance = nvl(temp.Balance,0) from Template ;
LEFT join TempTable Temp on Template.EmpNo = Temp.EmpNo
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform