Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating one field of records from another table
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00581256
Message ID:
00583426
Views:
35
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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform