Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating one field of records from another table
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00581256
Message ID:
00583426
Vues:
36
Hi Mark,
I tried this code you suggested with my tables and fields inserted but it gives the error message:
Function name is missing ).

I tried placing the closed parenthesis in several places although I can't seem to determine why it needs it as there is a corresponding close to every open parenthesis.

select TableA
set order to NameDate && index tag on FieldPersonName + DTOS(SomeDate)
select TableB
set relation to FieldPersonName + DTOS(SomeDate) into TableA
replace all FieldTotal with iif(eof('TableA'), 0, TableA.FieldTotal)
Update TableB set FieldTotal = (select TableA.FieldTotal from TableA where TableA.FieldPersonName + DTOS(SomeDate) in (select FieldPersonName + DTOS(SomeDate) from TableB))

Thanks
Max

>UPDATE: I remember now that you probably can not do this in VFP because >subqueries for an UPDATE - SQL are not supported. You will have to set a >relation between the 2 tables and do a REPLACE:

>select TableA
>set order to NameDate && index tag on FieldPersonName + DTOS(SomeDate)
>select TableB
>set relation to FieldPersonName + DTOS(SomeDate) into TableA
>replace all FieldTotal with iif(eof('TableA'), 0, TableA.FieldTotal)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform