Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update a template table
Message
 
 
À
31/07/2007 10:29:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01244862
Message ID:
01244863
Vues:
21
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform